LinearModel.stepwise uses interactions
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, LinearModel.stepwise produces a model with some interactions, even when set to 'linear'. It does not result in the same model as when it IS set to 'interactions'. Can someone please explain this, and perhaps the difference between these? Many thanks, JEL
0 comentarios
Respuestas (1)
the cyclist
el 7 de Feb. de 2016
Editada: the cyclist
el 7 de Feb. de 2016
I can't fully answer your question, because I don't fully understand it. But let me try to say some helpful things.
It is important to understand that the word "linear" in the phrase "linear model" means that the model is linear in the coefficients. It has nothing to do with the powers of the explanatory variables. So, for example,
y(x) = alpha + beta1*x + beta2*x^2
is a linear model (assuming y is the response variable, and x is the explanatory variable).
y(x) = alpha * sin(beta * x)
is not, because of the non-linear dependence on the coefficient beta.
A linear model can have interaction terms:
y(x1,x2) = A + B*x1 + C*x2 + D*x1*x2
is a linear model with interactions.
When describing models that have interactions, you will sometimes refer to the linear terms. In the above, B*x1 and C*x2 are the linear terms, and D*x1*x2 is the interaction term. (The terminology can definitely be confusing.)
Regarding different calls to LinearModel.stepwise giving different results ... I think it would be best if you gave a couple distilled examples. Otherwise, we're just guessing at exactly what you mean.
4 comentarios
the cyclist
el 8 de Feb. de 2016
The documentation for the Linear Model class discusses Properties and Methods. I took only a quick glance, but it looks like you are most interested in
mdl.Steps.History
where mdl is the model object.
Here's an example from the documentation of stepwiselm:
load hald
mdl = stepwiselm(ingredients,heat,'PEnter',0.06)
mdl.Steps.History
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!