Note: This page has been translated by MathWorks. Click here to see

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

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

Plot observation diagnostics of linear regression model

`plotDiagnostics`

creates a plot of observation diagnostics
such as leverage, Cook's distance, and delete-1 statistics to identify outliers and
influential observations.

`plotDiagnostics(mdl)`

`plotDiagnostics(mdl,plottype)`

`plotDiagnostics(mdl,plottype,Name,Value)`

`h = plotDiagnostics(___)`

`plotDiagnostics(`

creates a leverage
plot of the linear regression model (`mdl`

)`mdl`

) observations. A
dotted line in the plot represents the recommended threshold values.

`plotDiagnostics(`

specifies the graphical properties of diagnostic data points using one or more
name-value pair arguments. For example, you can specify the marker symbol and size
for the data points.`mdl`

,`plottype`

,`Name,Value`

)

returns graphics objects for the lines or contour in the plot using any of the input
argument combination in the previous syntaxes. Use `h`

= plotDiagnostics(___)`h`

to modify
the properties of a specific line or contour after you create the plot. For a list
of properties, see Line Properties and Contour 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.Use

`legend('show')`

to show the pre-populated legend.

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.

[1] Neter, J., M. H. Kutner, C. J. Nachtsheim, and W. Wasserman. *Applied
Linear Statistical Models*, Fourth Edition. Chicago: McGraw-Hill Irwin,
1996.