model spec 'polyijk' o=in fitlm does not work as per MATLAB documentation?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jerry Chen
el 22 de Mzo. de 2024
Comentada: Jerry Chen
el 22 de Mzo. de 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 comentarios
Respuesta aceptada
the cyclist
el 22 de Mzo. de 2024
Editada: the cyclist
el 22 de Mzo. de 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")
Más respuestas (0)
Ver también
Categorías
Más información sobre Regression en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!