Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

**Class: **CompactLinearModel

Plot interaction effects of two predictors in linear regression model

`plotInteraction(mdl,var1,var2)`

plotInteraction(mdl,var1,var2,ptype)

h = plotInteraction(___)

`plotInteraction(`

creates
a plot of the interaction effects of the predictors `mdl`

,`var1`

,`var2`

)`var1`

and `var2`

in `mdl`

.
The plot shows the estimated effect on the response from changing
each predictor value, averaging out the effects of the other predictors.
The plot also shows the estimated effect with the other predictor
fixed at certain values. `plotInteraction`

chooses
values to produce a relatively large effect on the response. The plot
lets you examine whether the effect of one predictor depends on the
value of the other predictor.

`plotInteraction(`

returns
a plot of the type specified in `mdl`

,`var1`

,`var2`

,`ptype`

)`ptype`

.

returns
handles to the lines in the plot, using any of the previous syntaxes.`h`

= plotInteraction(___)

For many plots, the Data Cursor tool in the figure window displays the

*x*and*y*values for any data point, along with the observation name or number.

Use `plotEffects`

for an effects plot showing separate
effects for all predictors.

Was this topic helpful?