Comparing 2 linear models

6 vues (au cours des 30 derniers jours)
patrick Joyce
patrick Joyce le 7 Août 2015
Hi, I need to compare whether 2 linear models are significantly different from each other. I am fairly new to Matlab and am struggling to understand why I can't get a difference. Here is my code:
Good = isnan(yh_col) + isnan(u_col);
mdl = fitlm(yh_col(Good==0), u_col(Good==0), 'poly3');
figure
plot (mdl)
Goodf = isnan(yf_col) + isnan(ufished_col);
mdlf = fitlm(yf_col(Goodf==0), ufished_col(Goodf==0), 'poly3');
hold on
plot (yf_col, ufished_col, 'bo')
plot (mdlf)
hold off
anova2(mdl, mdlf)
As I say, I have 2 linear models and wish to compare their differences.
Any help is greatly appreciated!
Thanks.
  1 commentaire
Uladzimir
Uladzimir le 7 Août 2015
Hi Patrick. I would recommend you to try "compare" function.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by