Filter löschen
Filter löschen

Polyfitn Function calculate the RMS value

3 Ansichten (letzte 30 Tage)
jupiter
jupiter am 21 Okt. 2016
Kommentiert: jupiter am 24 Okt. 2016
When I use 'polyfitn' function to fit 3D data, should I use 'polyvaln' function and calculate the RMS error? OR Can I directly consider the RMSE value from the function 'polyfitn' to be the RMS error. In both the cases, the values are different. But for all the cases I checked, the minima occurs at the same point for both the values. Is it safe to consider RMSE value?

Akzeptierte Antwort

John D'Errico
John D'Errico am 22 Okt. 2016
Bearbeitet: John D'Errico am 22 Okt. 2016
You can find the formula for RMSE easily enough. Here for example:
https://en.wikipedia.org/wiki/Root-mean-square_deviation
It is simply the sqrt of the mean of the squares of the errors, which is what polyfitn computes, as you can see:
polymodel.RMSE = sqrt(mean((depvar - yhat).^2));
So, you may have chosen a different formula for RMSE. I suppose there are others one might define, but the one in polyfitn is what seems to be standard.
I have no idea what you are asking about if it is safe to use the RMSE that polyfitn returns.
As a simple test:
M = rand(10,3);
y = rand(10,1)*10 + 10;
P = polyfitn(M,y,1);
pred = polyvaln(P,M);
sqrt(mean((pred - y).^2))
ans =
1.9747
P.RMSE
ans =
1.9747
I'm not sure what form you might have chosen here otherwise.
  1 Kommentar
jupiter
jupiter am 24 Okt. 2016
Thank you John, while I was also doing the same thing but calculating the sum and then dividing it by the number of elements (Old school way :)), only a factor of cube at the denominator was causing the difference in the result. Now everything is working fine.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Chemistry finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by