我正在从通用模型,线性模型和混合模型复制示例。我的MWE如下:
Dilution <- c(1/128, 1/64, 1/32, 1/16, 1/8, 1/4, 1/2, 1, 2, 4)
NoofPlates <- rep(x=5, times=10)
NoPositive <- c(0, 0, 2, 2, 3, 4, 5, 5, 5, 5)
Data <- data.frame(Dilution, NoofPlates, NoPositive)
fm1 <- glm(formula=NoPositive/NoofPlates~log(Dilution), family=binomial("logit"), data=Data)
summary(object=fm1)
输出量
Call:
glm(formula = NoPositive/NoofPlates ~ log(Dilution), family = binomial("logit"),
data = Data)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.38326 -0.20019 0.00871 0.15607 0.48505
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 4.174 2.800 1.491 0.136
log(Dilution) 1.623 1.022 1.587 0.112
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 8.24241 on 9 degrees of freedom
Residual deviance: 0.64658 on 8 degrees of freedom
AIC: 6.8563
Number of Fisher Scoring iterations: 6
码
anova(object=fm1, test="Chisq")
输出量
Analysis of Deviance Table
Model: binomial, link: logit
Response: NoPositive/NoofPlates
Terms added sequentially (first to last)
Df Deviance Resid. Df Resid. Dev Pr(>Chi)
NULL 9 8.2424
log(Dilution) 1 7.5958 8 0.6466 0.00585 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
码
library(aod)
wald.test(b=coef(object=fm1), Sigma=vcov(object=fm1), Terms=2)
输出量
Wald test:
----------
Chi-squared test:
X2 = 2.5, df = 1, P(> X2) = 0.11
估计的系数与书中给出的结果完全匹配,但SE的相距很远。基于LRT测试,斜率显着,但基于Wald和Z测试,斜率系数不明显。我想知道我是否想念一些基本的东西。在此先感谢您的帮助。
相关:为什么我的p值在逻辑回归输出,卡方检验和OR的置信区间之间不同?
—
gung-恢复莫妮卡