use*_*592 12 r extract standard-error glm
我做了一个glm,我只是想提取每个系数的标准误差.我在互联网上看到了这个功能,se.coef()但它不起作用,它返回"Error: could not find function "se.coef"".
Cha*_*ase 33
您所追踪的信息存储在coefficients返回的对象中summary().你可以这样提取它:summary(glm.D93)$coefficients[, 2]
#Example from ?glm
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
print(d.AD <- data.frame(treatment, outcome, counts))
glm.D93 <- glm(counts ~ outcome + treatment, family=poisson())
#coefficients has the data of interest
> summary(glm.D93)$coefficients
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.044522e+00 0.1708987 1.781478e+01 5.426767e-71
outcome2 -4.542553e-01 0.2021708 -2.246889e+00 2.464711e-02
outcome3 -2.929871e-01 0.1927423 -1.520097e+00 1.284865e-01
treatment2 1.337909e-15 0.2000000 6.689547e-15 1.000000e+00
treatment3 1.421085e-15 0.2000000 7.105427e-15 1.000000e+00
#So extract the second column
> summary(glm.D93)$coefficients[, 2]
(Intercept) outcome2 outcome3 treatment2 treatment3
0.1708987 0.2021708 0.1927423 0.2000000 0.2000000
Run Code Online (Sandbox Code Playgroud)
看看names(summary(glm.D93))为返回,一切都快速审查.通过检查summary.glm是否要查看正在进行的特定计算可以找到更多详细信息,但每次都不需要详细程度,除非您<3统计.
小智 5
se.coef() 实际上确实有效。但它不在基础包中:它在 {arm} 包中:http : //www.inside-r.org/packages/cran/arm/docs/se.ranef