我做了glm
,我只是想提取每個係數的標準錯誤。我在網上看到功能se.coef()
但它不起作用,它返回"Error: could not find function "se.coef""
。從glm中提取標準錯誤
回答
您所追求的信息存儲在由summary()
返回的coefficients
對象中。您可正是如此解壓: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
看看names(summary(glm.D93))
爲返回,一切都快速審查。如果您想查看正在進行的特定計算,則可以通過查看summary.glm
來找到更多詳細信息,儘管可能每次都不需要詳細級別的詳細信息,除非您有統計信息。
標準錯誤是否存儲在`glm.D93`對象中?我無法用`str()`來注視它。或者`summary()`明確計算錯誤? – 2011-12-14 12:40:44
@ mindless.panda - AFAIK它們是由`summary.glm`直接計算出來的。如果你在控制檯輸入函數sans`()`,然後向下滾動約25行,你會看到它的計算位置。 – Chase 2011-12-14 15:12:55
另一種方式:
sqrt(diag(vcov(glm.D93)))
se.coef()實際上做的工作。但它不在基本包中:它位於{arm}包中:http://www.inside-r.org/packages/cran/arm/docs/se.ranef
- 1. 從tsls輸出中提取標準錯誤
- 2. 如何從glm中提取aic?
- 3. GLM中的奇怪錯誤
- 4. 從logcat中提取錯誤
- 5. 從intellij/android studio中獲取jUnit的標準錯誤輸出
- 6. 使用rpy2從迴歸中獲取標準錯誤
- 7. 如何從C#讀取PowerShell腳本標準輸出和標準錯誤#
- 8. 同時讀取子進程標準輸出和標準錯誤
- 9. Eclipse插件讀取標準錯誤
- 10. 在R中從glm和lmer中提取的剩餘方差
- 11. 提取位標準:: bitset的
- 12. 可可豆莢GLM錯誤
- 13. GLM在statsmodel返回錯誤
- 14. 從標準錯誤標準輸出上區分開管
- 15. 如何從標準輸出和標準錯誤
- 16. 從Jython控制標準輸出/標準錯誤
- 17. 從C#重定向原生dll標準輸出/標準錯誤#
- 18. 從標準庫鏈接錯誤 - Visual Studio
- 19. GCC編譯錯誤來從標準
- 20. 從glm中提取獨特的係數估計
- 21. 從R的anova(glm)中提取殘餘偏差
- 22. 從glm模型中提取參考類別的最佳方法?
- 23. glm中矩陣值的順序錯誤?
- 24. EOF錯誤從標準輸入讀取數據時 - Python3
- 25. C從標準錯誤讀取字符串
- 26. 從高架子進程獲取錯誤和標準輸出
- 27. 從標準輸入讀取的分段錯誤(核心轉儲)
- 28. 從InnerException中提取SqlException錯誤號
- 29. Angular2從錯誤中提取json
- 30. 從錯誤表中提取SQL
可能有助於提供一些數據和示例代碼。 – screechOwl 2011-12-13 21:01:16