LinearModel.stepwise uses interactions

조회 수: 15 (최근 30일)
John Layne
John Layne 2016년 2월 6일
댓글: the cyclist 2016년 2월 8일
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

답변 (1개)

the cyclist
the cyclist 2016년 2월 7일
편집: the cyclist 2016년 2월 7일
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
John Layne
John Layne 2016년 2월 7일
Many thanks, Cyclist! Can you tell me how I can gain access to the contents of a model object? As in, the output from LinearModel.stepwise. I can't even tell what it contains.
the cyclist
the cyclist 2016년 2월 8일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multiple Linear Regression에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by