glm() and lm() 您所在的位置:网站首页 r软件gl函数 glm() and lm()

glm() and lm()

2023-07-25 20:54| 来源: 网络整理| 查看: 265

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 实验室设备网 版权所有