我从一篇研究论文中获得了以下数据:
S1 : n = 30 / Rest : n = 66
SH 11 / 8
为了计算 p 值,我做了如下操作:
library(MASS)
x = matrix(c(19,11,58,8), nrow=2, byrow=T)
D = factor(c("S1","SH"), levels=c("S1","SH"))
m = glm(x~D, family=binomial)
summary(m)
Call:
glm(formula = x ~ D, family = binomial)
Deviance Residuals:
[1] 0 0
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.5465 0.3789 1.443 0.14914
DSH 1.4345 0.5346 2.683 0.00729 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 7.3387e+00 on 1 degrees of freedom
Residual deviance: -8.8818e-16 on 0 degrees of freedom
AIC: 11.607
Number of Fisher Scoring iterations: 3
p 值为 0.007。这和我在研究论文中看到的一样。优势比为 4.20,95% CI 为 (1.47-11.97)
我想知道如何为此计算优势比和 95% 置信区间?谁能告诉我如何在R中计算这个?有什么功能吗?