Michela Leone
2016-Nov-23 11:54 UTC
[R] How to extract parameters from train in caret package
Dear R-users, I need to extract coefficients from the final model after running train function of caret package. I need to have something like "summary" used after running a regression model in this case from the best model. below my script as explanation data(Sonar) set.seed(107) inTrain <- createDataPartition(y = Sonar$Class, p = .75, list = FALSE) training <- Sonar[ inTrain,] testing <- Sonar[-inTrain,] plsFit <- train(Class ~ ., data = training, method = "pls", tuneLength = 15, preProc = c("center", "scale")) What I need is a summary which looks like Call: glm(formula = Class ~ ., family = "binomial", data = training) Deviance Residuals: Min 1Q Median 3Q Max -2.418e-05 -2.110e-08 -2.110e-08 2.110e-08 2.697e-05 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 1.081e+02 2.668e+05 0.000 1.000 V1 7.235e+02 4.390e+06 0.000 1.000 V2 -1.024e+03 2.282e+06 0.000 1.000 V3 1.113e+03 2.735e+06 0.000 1.000 V4 -7.072e+02 1.828e+06 0.000 1.000 V5 -1.542e+01 1.534e+06 0.000 1.000 V6 -1.983e+02 1.438e+06 0.000 1.000 V7 2.543e+02 1.465e+06 0.000 1.000 V8 3.507e+02 8.199e+05 0.000 1.000 V9 -4.010e+02 8.517e+05 0.000 1.000 V10 4.317e+01 9.660e+05 0.000 1.000 V11 1.364e+02 1.800e+06 0.000 1.000 V12 -4.606e+02 2.350e+06 0.000 1.000 V13 1.746e+02 1.246e+06 0.000 1.000 Null deviance: 2.1688e+02 on 156 degrees of freedom Residual deviance: 1.0630e-08 on 96 degrees of freedom AIC: 122 Number of Fisher Scoring iterations: 25 Many thanks for your help ! Michela Leone [[alternative HTML version deleted]]