3

When I'm fitting a generalized linear model, I use the glm() function like this:

fit <- glm(formula=y ~ x, 
           data=someFrame, 
           family=gaussian(link="log"))

But I don't know, what does the name of the family mean. It's described like this in the the documentation:

Family objects provide a convenient way to specify the details of the models used by functions such as glm. See the documentation for glm for the details on how such model fitting takes place.

But still, I don't know, what is it exactly. Is it an estimated distribution of observed data?

Eenoku
  • 443
  • 8
  • 17
  • 2
    Have you looked at any information about GLMs? For example [Wikipedia's page on GLMs](https://en.wikipedia.org/wiki/Generalized_linear_model), in particular the section on [model components](https://en.wikipedia.org/wiki/Generalized_linear_model#Model_components)? There's also a table of the most commonly used distributions lower down on that page. Introductory documents on GLMs may be even more useful. Note that the distribution is a model for the conditional distribution of the response. – Glen_b Apr 10 '17 at 10:52

1 Answers1

-3

GLMs are generalized Linear models with three components - probability distribution, a linear predictor, and a link function that relates the linear predictor to the expected value of the probability distribution for the response which I will denote as Y.

The family argument here helps define the link function.

This link function provides a transformation of the response variable(Y) which is now linearly related to the predictors.

Pb89
  • 255
  • 5
  • 18
  • I know, what the link function is. But, for example `gaussian(link="log")` differs from `poisson(link="log")`, doesn't it? – Eenoku Apr 10 '17 at 09:13
  • Yes they are different , while one being discrete distribution and the other being continous distribution , and depending on the problem problem statement for example if you have event time based modelling , you may use poisson. refer to this, may help [link] http://stats.stackexchange.com/questions/94852/glm-gaussian-vs-glm-binomial-vs-log-link-glm-gaussian – Pb89 Apr 10 '17 at 09:22
  • The Family by itself do not define the link function, for instance, binomial Family can have logir, probit, complementary loglog, or other link functions. – kjetil b halvorsen Apr 10 '17 at 12:32
  • 6
    Incorrect. The link function does not transform the response; it makes it so that you're modeling a transformed version of the expected value. e.g. the log link means you're modeling $\log( E(Y) )$... This is totally different from log-transforming the response---when you log-transform the response in an otherwise unlinked GLM, you are modeling $E(\log(Y))$. – gammer Apr 21 '17 at 02:00
  • If I were to elect the most useful comment in the whole CV, @gammer 's here would probably win by a fair margin. – Firebug Sep 21 '17 at 18:08