# R language. How to retrieve Mean of squared residuals in random forest? [closed]

Probably a simple question: how may I to retrieve the Mean of squared residuals of regression when using randomForest?

Thank you!

• Questions solely about how software works are off-topic here, but you may have a real statistical question buried here. You may want to edit your question to clarify the underlying statistical issue. You may find that when you understand the statistical concepts involved, the software-specific elements are self-evident or at least easy to get from the documentation. – gung - Reinstate Monica Sep 1 '16 at 7:56

Can you provide more details on what software or tool you are using? depending on how you are running your randomforest- i.e if through cross validation and caret package, you can specify the RMSE as your metric: metric="RMSE"

• OK ,I'll take RMSE to compare the real value and prevalues – E. Song Sep 1 '16 at 12:34

You can calulate manually if need be: something along the lines of

## model is your model object
## data is your data, with response column "response"
predValues <- predict(model,data)
mean((predValues-data\$response)^2)
## alternatively, sqrt() of the above expression

• thank you very much. I have not noticed the predValues of model – E. Song Sep 1 '16 at 12:31