Effacer les filtres
Effacer les filtres

Polyfitn Function calculate the RMS value

3 vues (au cours des 30 derniers jours)
jupiter
jupiter le 21 Oct 2016
Commenté : jupiter le 24 Oct 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?

Réponse acceptée

John D'Errico
John D'Errico le 22 Oct 2016
Modifié(e) : John D'Errico le 22 Oct 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 commentaire
jupiter
jupiter le 24 Oct 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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Chemistry dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by