caret train function with cross validation gives two sets of RMSE results?

I am following an example in RPubs by Jose Vilardy but with different data. See
https://rpubs.com/josevilardy/crossvalidation
str(modelcv) command refers to $finalModel and $results.
caret train function with cv gives two RMSE values. What are they?

model <- as.formula("y ~ z + x2 + x4 + x5 + x6 + x10 + x11")
set.seed(12345)
library(caret)
train.control <- trainControl(method="cv",number=10)
modelcv <- train(model, data=train.data, method= "lm", trControl=train.control)
modelcv.Anova <- summary(modelcv)
modelcv.Anova
#  (1) RMSE REPORTED AS RESAMPLED CROSS-VALIDATED
#       is this rmse from training set?
modelcv  

# (2) cross validated results is obtained using str() command. 
#     What is this? I am predicting using test.data.
RMSE_train.data <- modelcv$results$RMSE
pred <- predict(modelcv,test.data)
errorcv <- (pred - test.data$y)
RMSE_test.data <- sqrt(mean(errorcv^2))

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.