统计数据和R想知道是否有一种方法可以将p值从glm添加到由以下命令产生的输出的末尾:
exp(cbind(OR = coef(mod1), confint(mod1)))
也许是这样的:
summary(mod1)$coefficients[,4]
我意识到这在某种程度上是一个“化妆品”问题,但它还是很方便的。
谢谢
发布于 2014-03-05 02:02:40
您可以保存摘要结果(Mod1),然后使用coefficients
访问系数表。
你可以写一个函数为你完成整个过程.
OR.summary <- function(x){
# get the summary
xs <- summary(x)
# and the confidence intervals for the coefficients
ci = confint(x)
# the table from the summary object
coefTable <- coefficients(xs)
# replace the Standard error / test statistic columns with the CI
coefTable[,2:3] <- ci
# rename appropriatly
colnames(coefTable)[2:3] <- colnames(ci)
# exponentiate the appropriate columns
coefTable[,1:3] <- exp(coefTable[,1:3])
# return the whole table....
coefTable
}
一种更健壮的方法是使用像rms
这样的软件包.
https://stackoverflow.com/questions/22186817
复制相似问题