Skip to content

DOC: Improve documentation about glm #2959

Closed

Description

@lorentzenchr

The documentation about Generalized Linear Models is not very detailed. As is the case in the chapter about linear regression, one could specify the underlying stochastic model, e.g. Y ~ ExpFamily, and then specify the exponential family. The docu just states: "Generalized linear models currently supports estimation using the one-parameter exponential families".

In short: Some more formulas would be helpful, not only in the chapter about glms (cf. docu of scikit-learn).

Activity

  1. josef-pkt commented on May 19, 2016

    @josef-pkt
    Member

    PRs and improvements would be very welcome and appreciated.

    It's a lot of work to write documentation, and even more so vignette length versions.

    In the case of GLM essentially everything is standard, and any textbook and maybe Wikipedia provides the relevant formulas.
    (I'm looking mostly at SAS and SPSS technical documentation or the source, when I want to see the actual formulas for different families. I don't find the generic GLM likelihood very informative and it is not directly used in any code, but every article or book starts with it.)

    When I write documentation for parts where it is still missing, then I try to focus on things where references are not easily accessible or where implementation details are not standard across packages.

    Another area where I lost an overview (especially for my code and for older code) is what references were used for the implementation. And what are references that can be recommended to users, especially if the implementation references are too heavy.
    https://github.com/josef-pkt/misc/wiki/References-for-Implementation
    In many parts the references are in the docstrings or code comments but not everywhere.

  2. josef-pkt commented on May 20, 2016

    @josef-pkt
    Member

    Actually, for the parameter estimation the only things that are relevant are the link function for mean and the variance function for weighting observations, and the implied constraints on the support/domain of the response.
    I think I've seen a nice table for this in the documentation of some other package.

    family/distribution are relevant if we want to have full MLE interpretation, e.g. loglike, ...

  3. thequackdaddy commented on May 20, 2016

    @thequackdaddy
    Member

    Josef,

    Can you discuss your argument that the only things that are relevent for parameter estimation are the link and variance function?

    I get what you are saying insofar as the variance function is part of the calculation for W, but I've always been under the impression that that variance function is part of the family for all GLMs. Take page 95 of this text. I was always under the impression that the variance function was tied to the family, so necessary for parameter estimation as well? Maybe I'm confused again.

  4. josef-pkt commented on May 20, 2016

    @josef-pkt
    Member

    @thequackdaddy The way the estimator and the variance function are derived and are implemented is through the family.
    However, like in OLS/WLS properties of the family/distribution other than expected response (mean function) and variance don't show up in the estimating equation.
    And interpreted as Quasi-MLE, the mean parameter estimates are consistent if the mean function is specified, and the are efficiently (minimum asymptotic variance) estimated if the variance function is correctly specified. The rest doesn't really matter for estimating the mean parameters.
    (We need sandwich robust covariance matrix for the mean parameters for inference if the variance or covariances are misspecified.)

    This is all we need if we want to predict the mean/expected value of a new information given the explanatory variables.
    However, it's not enough if we want to find the distribution for predicting a new value, e.g. use Poisson to evaluate the prediction distribution. In that case we need a fully and correctly specified family.

    (aside: in several usecases we want to misuse or redefine a variance function, which is perfectly fine as QMLE, but there might not be an actual known distribution for it. And it's a bit like Tweedie right now, where we only use link and variance function in the estimation.)

    It's not a very widespread view among people that focus on MLE, and I only started to go through the details in the GLM context maybe 3 years ago.
    But it's a bit similar to the view that looks at OLS or linear model mainly through the normal distribution, which is completely irrelevant for mean prediction based on large samples (after making some other "technical" assumption like finite 4th moment which rules out very heavy tailed distributions and big outliers.)

  5. josef-pkt commented on May 20, 2016

    @josef-pkt
    Member

    nice exercise that I haven't tried, but I tried something similar:
    use GLM with gaussian family and log link for a nonnegative response and override the variance function to be var = mean, i.e. Poisson.
    I think the parameter and scale estimates should be exactly the same as over- or underdispersed GLM with family Poisson.
    (There is currently no option to change the variance function, but it's possible to cheat by assigning to the attribute of the model.)

  6. lorentzenchr commented on Jan 3, 2017

    @lorentzenchr
    ContributorAuthor
  7. added a commit that references this issue on Jan 30, 2017
  8. 2 remaining items

  9. lorentzenchr commented on Mar 28, 2020

    @lorentzenchr
    ContributorAuthor

    Closed with PR #3364.

  10. added this to the 0.12 milestone on Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions