glm() and lm() | 您所在的位置:网站首页 › r软件gl函数 › glm() and lm() |
In R, using lm() is a special case of glm(). lm() fits models following the form Y = Xb + e, where e is Normal (0 , s^2). glm() fits models following the form f(Y) = Xb + e. However, in glm both the function f(Y) (the ‘link function’) and the distribution of the error term e can be specified. Hence the name - ‘generalised linear model’. If you are getting the same results using both lm() and glm(), it is because for glm(), f(Y) defaults to Y, and e defaults to Normal (0, s^2). i.e. if you don’t specify the link function and error distribution, the parameters that glm() uses produce the same effect as running lm(). |
CopyRight 2018-2019 实验室设备网 版权所有 |