逻辑回归 - glm中的cbind命令

时间:2012-02-02 11:35:09

标签: r regression glm

我在R中进行逻辑回归。有人可以澄清运行这两行的区别是什么?

1. glm(Response ~ Temperature, data=temp, 
                    family = binomial(link="logit"))
2. glm(cbind(Response, n - Response) ~ Temperature, 
                    data=temp, family =binomial, Ntrials=n)

数据如下所示: (注意:响应是二进制的.0 =死1 =不死)

Response  Temperature
0         24.61
1         39.61
1         39.50
0         22.71
0         21.61
1         39.70
1         36.73
1         33.32
0         21.73
1         49.61

1 个答案:

答案 0 :(得分:13)

在进行二项式或准二项式glm时,您要么提供成功概率,要么提供两列矩阵,其中列给出成功和失败的数量,或者第一级表示失败的因素,以及其他等式左边的成功。请参阅?glm

中的详细信息