model spec 'polyijk' o=in fitlm does not work as per MATLAB documentation?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jerry Chen
am 22 Mär. 2024
Kommentiert: Jerry Chen
am 22 Mär. 2024
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 Kommentare
Akzeptierte Antwort
the cyclist
am 22 Mär. 2024
Bearbeitet: the cyclist
am 22 Mär. 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")
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Regression 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!