Asked by Joe
on 27 Mar 2011

[EDIT: 20110610 00:17 CDT - reformat - WDR]

So i was looking online how to check the RMSE of a line. found many option, but I am stumble about something,

Dates - a Vector

Scores - a Vector

is this formula is the same as RMSE=sqrt(sum(Dates-Scores).^2)./Dates

or did I messed up with something?

Answer by John D'Errico
on 10 Jun 2011

Accepted Answer

Yes, it is different. The Root Mean Squared Error is exactly what it says.

(y - yhat) % Errors

(y - yhat).^2 % Squared Error

mean((y - yhat).^2) % Mean Squared Error

RMSE = sqrt(mean((y - yhat).^2)); % Root Mean Squared Error

What you have written is different, in that you have divided by dates, effectively normalizing the result. Also, there is no mean, only a sum. The difference is that a mean divides by the number of elements. It is an average.

sqrt(sum(Dates-Scores).^2)./Dates

Thus, you have written what could be described as a "normalized sum of the squared errors", but it is NOT an RMSE. Perhaps a Normalized SSE.

imo88
on 23 Feb 2017

Dear John, your answer has helped many of us! I'm also struggling with RMSE and I want to calculate the minimum and maximum RMSE for each row of data. based on this example from Joe, would it make sense to use these functions for the calculation of the minimum and maximum value to have an idea about the rmse range?

RMSE_min_range=RMSE./abs(min(y,[],yhat))

RMSE_max_range=RMSE./abs(max(y,[],yhat))

Image Analyst
on 23 Feb 2017

To compute the range of an array (of any dimension), simply do this:

RMSE_min = min(RMSE(:));

RMSE_max = max(RMSE(:));

RMSE_range = RMSE_max - RMSE_min;

imo88
on 23 Feb 2017

Dear image analyst, Thank you very much for your reply and help! You really helped me a lot!

Sign in to comment.

Answer by Image Analyst
on 9 Jan 2016

If you have the Image Processing Toolbox, you can use immse():

rmse = sqrt(immse(scores, dates));

Lina Eyouni
on 25 Jul 2016

Image Analyst
on 23 Feb 2017

It will work with matrixed, no problem. Just pass in your two matrices:

err = immse(X,Y) calculates the mean-squared error (MSE) between the arrays X and Y. X and Y can be arrays of any dimension, but must be of the same size and class.

arun kumar
on 26 Jul 2017

Thank you. Even i was having same doubt

Sign in to comment.

Answer by Yella
on 10 Jun 2011

Root mean square error is difference of squares of output an input. Let say x is a 1xN input and y is a 1xN output. square error is like (y(i) - x(i))^2. Mean square error is 1/N(square error). and its obvious RMSE=sqrt(MSE).

ur code is right. But how r dates and scores related?

Enne Hekma
on 9 Jan 2016

RMSE= sqrt(MSE) = sqrt( 1/length(y)* sum( (y-yhat).^2 )) = sqrt( mean(y-yhat).^2 )

However, he divided after the square root.

Sign in to comment.

Answer by ziad zaid
on 4 Jun 2017

Image Analyst
on 4 Jun 2017

Sign in to comment.

Answer by Siddhant Gupta
on 3 Jul 2018

if true

% code

end

y=[1 2 3]

yhat=[4 5 6]

(y - yhat)

(y - yhat).^2

mean((y - yhat).^2)

RMSE = sqrt(mean((y - yhat).^2));

RMSE

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.