Scatter plot or added variable plot of linear regression model
plot(
creates a plot of the linear
regression model mdl
)mdl
. The plot type depends on the number of
predictor variables.
If mdl
includes multiple predictor variables,
plot
creates an Added Variable Plot for the whole model except the
constant (intercept) term, equivalent to
plotAdded(mdl)
.
If mdl
includes a single predictor variable,
plot
creates a scatter plot of the data along
with a fitted curve and confidence bounds.
If mdl
does not include a predictor,
plot
creates a histogram of the residuals,
equivalent to plotResiduals(mdl)
.
returns
graphics objects for the lines or patch in the plot, using any of the input argument
combinations in the previous syntaxes. Use h
= plot(___)h
to modify the
properties of a specific line or patch after you create the plot. For a list of
properties, see Line Properties and Patch Properties.
The data cursor displays the values of the selected plot point in a data tip (small text box located next to the data point). The data tip includes the x-axis and y-axis values for the selected point, along with the observation name or number.
A LinearModel
object provides multiple plotting functions.
When creating a model, use plotAdded
to understand the effect of adding or removing a predictor
variable.
When verifying a model, use plotDiagnostics
to find questionable data and to understand the
effect of each observation. Also, use plotResiduals
to analyze the residuals of the model.
After fitting a model, use plotAdjustedResponse
, plotPartialDependence
, and plotEffects
to understand the effect of a particular predictor. Use
plotInteraction
to understand the
interaction effect between two predictors. Also, use plotSlice
to plot slices through the prediction surface.
The plot
function creates an added variable plot for the
model as a whole (except a constant term) if the model includes multiple terms.
Use plotAdded
to select particular
predictors for an added variable plot.