Compare 2 regression models
Afficher commentaires plus anciens
I wonder if there is any tool to compare 2 regression models on the same sample pool. In general more terms you put into the model the closer the fit, but you risk over fitting. For example:
>> mdl=fitglm(FitZV,FitDataV,'linear')
mdl =
Generalized linear regression model:
y ~ 1 + x1
Distribution = Normal
Estimated Coefficients:
Estimate SE tStat pValue
________ __________ _______ ______
(Intercept) 81.101 0.0085111 9528.9 0
x1 -0.22506 0.00058189 -386.77 0
9638 observations, 9636 error degrees of freedom
Estimated Dispersion: 0.698
F-statistic vs. constant model: 1.5e+05, p-value = 0
>> mdl2=fitglm(FitZV,FitDataV,'purequadratic')
mdl2 =
Generalized linear regression model:
y ~ 1 + x1 + x1^2
Distribution = Normal
Estimated Coefficients:
Estimate SE tStat pValue
___________ __________ _______ __________
(Intercept) 81.286 0.012269 6625.6 0
x1 -0.22447 0.00057029 -393.6 0
x1^2 -0.00086632 4.2147e-05 -20.555 6.3993e-92
9638 observations, 9635 error degrees of freedom
Estimated Dispersion: 0.668
F-statistic vs. constant model: 7.83e+04, p-value = 0
Both mdl and mdl2 are statically better than a constant model, but does mdl2 explain the dataset significantly better than mdl (or the oppsite)? From what I have found devianceTest only test the model to constant, but couldn't find a function to compare 2 models? If anyone can point me to the right direction that would be appreciated.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Multiple Linear Regression dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!