RMSE (root mean square deviation) calculation in R

Vicki1227 picture Vicki1227 · Oct 7, 2014 · Viewed 86.2k times · Source

I have numeric feature observations V1 through V12 taken for a target variable Wavelength. I would like to calculate the RMSE between the Vx columns. Data format is below.

Each variable "Vx" is measured at a 5-minute interval. I would like to calculate the RMSE between the observations of all Vx variables, how do I do that?

I have different observations for Wavelength variable, each variable ,Vx is measured at 5-minute interval,

This is a link I found, but I'm not sure how I can get y_pred: https://www.kaggle.com/wiki/RootMeanSquaredError

For the link provided below, I don't think I have the predicted values: http://heuristically.wordpress.com/2013/07/12/calculate-rmse-and-mae-in-r-and-sas/

Answer

Fernando picture Fernando · Oct 7, 2014

The function below will give you the RMSE:

RMSE = function(m, o){
  sqrt(mean((m - o)^2))
}

m is for model (fitted) values, o is for observed (true) values.