我想从下面的R输出中提取单个统计信息。怎么办?
# R code
library(pscl)
full <- glm(RESPONSE ~ as.factor(SEX) + TOTCHOL + AGE + ...,
data=training, family=binomial(link="logit"))
summary(full)
# McFadden's GOF pseudo R-squared, 0.2 to 0.4 indicates good model fit
McFadden=round(pR2(full),digits=4)['McFadden']; McFadden
输出:
library(pscl)
round(pR2(reduced),digits=4)
llh llhNull G2 McFadden r2ML r2CU
-165.6085 -191.1523 51.0875 0.1336 0.0663 0.1651
错误:
pR2$McFadden
Error in pR2$McFadden : object of type 'closure' is not subsettable
答案 0 :(得分:0)
我猜你没有给我们所有的代码,并且reduced
被赋予回归调用的值并且看起来是一个向量而不是列表,所以你可能(可能)使用像这个未经测试的代码:
round(pR2(reduced),digits=4)['McFadden']