R:访问由train函数生成的finalModel的标准错误

时间:2014-08-31 11:41:15

标签: r r-caret

我正在使用插入符号包中的train函数对多项逻辑模型执行10次交叉验证。 E.g:

library(caret)
data(iris)

logmodel <- train(iris[,-5], iris[,5], method = "multinom", maxit=500, tuneLength=1, trControl = trainControl(method = "cv", number=10, savePredictions=TRUE))
logmodel$finalModel

Call:
multinom(formula = .outcome ~ ., data = dat, decay = param$decay, 
maxit = 500)

Coefficients:
           (Intercept) Sepal.Length Sepal.Width Petal.Length Petal.Width
versicolor    18.40821    -6.082250   -9.396625     16.17037   -2.058115
virginica    -24.23006    -8.547304  -16.077164     25.59963   16.227474

Residual Deviance: 11.89873 
AIC: 31.89873 

我想知道是否有办法访问finalModel系数的标准错误才能执行Wald Tests?

非常感谢。

1 个答案:

答案 0 :(得分:1)

尝试:

summary(logmodel$finalModel)$standard.errors
 #          (Intercept) Sepal.Length Sepal.Width Petal.Length Petal.Width
 #versicolor    22.60423     38.59757    40.37292     109.0394    60.45127
 #virginica     23.61509     38.61528    40.53559     109.1778    60.76815