简体   繁体   中英

Root mean square error (RMSE) using R for the Boston Housing Data:

I appreciate any form of idea or assistance you put into this.

I have presented with an assignment with the Boston Housing data.

The goal is to make a prediction using randomForest. The quantity to optimize is the RMSE.

I am confused as to how to go about the RMSE. Please help guys

Thanks

I have tried following the RMSE formula and I have gone through the basic idea but I am not making any progress. Please guide

Thanks

  raw.data <- read.csv("Boston Housing data.csv", header = T, sep = "")
  fit1<-lm(raw.data$MEDV~.,data = raw.data)
  RMSE<- sqrt(mean((raw.data-fit1)^2),na.strings="?")

Error in Ops.data.frame(raw.data, fit1) : list of length 12 not meaningful

Looks like you're trying to subtract fitted values from the entire raw.data data frame. Updating your RMSE line should fix it:

RMSE<- sqrt(mean((raw.data$MEDV - fit1$fittedvalues)^2),na.strings="?")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM