model spec 'polyijk' o=in fitlm does not work as per MATLAB documentation?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I am trying to use 'polyijk' model spec to specify my linear regression model complexity when using fitlm, but i dont seem to be getting what the documentation suggests i should. As per documentation: 'poly13' has an intercept and x1, x2, x2^2, x2^3, x1*x2, and x1*x2^2 terms. but when i try it, the terms i get are: 1 + x1*x2 + x2^2 + x1:(x2^2) + x2^3. so somehow it is missing the x1 and x2 terms.
0 commentaires
Réponse acceptée
the cyclist
le 22 Mar 2024
Modifié(e) : the cyclist
le 22 Mar 2024
I think you are just misinterpreting the Wilkinson notation of the model spec in the output.
x1*x2 % note the * for interaction, which includes lower-order terms
is short-hand for
x1 + x2 + x1:x2 % note the : for interaction, which does NOT include lower-order terms
Here is an example. Note that all the terms you expect are in the table of estimated coefficients.
load carsmall
X1 = Acceleration;
X2 = Displacement;
X = [X1,X2];
y = Weight;
mdl = fitlm(X,y,"poly13")
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Regression 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!