我昨天坐了四个小时试图从R获得输出,我知道如果将来使用它我需要阅读R。我使用我的大学指南下载了R for Mac,但其指南已经过时了。当我尝试下载最新版本(+ extras)但不断出错时。
但是,我有一小组数据,我需要一个广义线性模型 - 二项式(logit)输出。任何人都可以帮助我获得它吗?我非常感谢这样的帮助。如果我能得到“代码”,我也会感激不尽,所以我可以从中学习。再次感谢。
sort temp survive total
0 1 29 29
0 8 19 20
0 10 27 29
0 12 30 30
0 14 20 29
0 18 15 30
0 20 11 20
1 1 27 28
1 8 21 28
1 10 21 26
1 12 20 27
1 14 8 27
1 18 4 30
1 20 1 10
答案 0 :(得分:0)
如果survive
是total
次审核的成功次数,则temp
和sort
是您的协变量,您的数据框名称为db
,然后:< / p>
result <- glm(cbind(survive, total-survive) ~ temp+sort,family=binomial(logit), data=db)
然后看看你得到了什么
summary(result)
给你(根据你的数据)
Call:
glm(formula = cbind(survive, total - survive) ~ temp + sort,
family = binomial(logit), data = db)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.6671 -0.6430 -0.3071 0.9203 2.5942
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 5.90102 0.64433 9.158 < 2e-16 ***
temp -0.31415 0.03823 -8.216 < 2e-16 ***
sort -1.83193 0.31458 -5.823 5.77e-09 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 158.445 on 13 degrees of freedom
Residual deviance: 19.682 on 11 degrees of freedom
AIC: 62.063
Number of Fisher Scoring iterations: 5