This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

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.


Class: NonLinearModel

Plot diagnostics of nonlinear regression model


h = plotDiagnostics(...)
h = plotDiagnostics(mdl,plottype,Name,Value)


plotDiagnostics(mdl) plots diagnostics from the mdl linear model using leverage as the plot type.

plotDiagnostics(mdl,plottype) plots diagnostics in a plot of type plottype.

h = plotDiagnostics(...) returns handles to the lines in the plot.

h = plotDiagnostics(mdl,plottype,Name,Value) plots with additional options specified by one or more Name,Value pair arguments.

Input Arguments


Nonlinear regression model, constructed by fitnlm.


Character vector specifying the type of plot:

'contour'Residual vs. leverage with overlayed Cook's contours
'cookd'Cook's distance
'leverage'Leverage (diagonal of Hat matrix)

Default: 'leverage'

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.


The plot property name-value pairs apply to the first returned handle h(1).


Color of the line or marker, a ColorSpec specification. For details, see linespec.


Type of line, a Line Properties specification. For details, see linespec.


Width of the line or edges of filled area, in points, a positive scalar. One point is 1/72 inch.

Default: 0.5


Color of the marker or edge color for filled markers, a ColorSpec specification. For details, see linespec.


Color of the marker face for filled markers, a ColorSpec specification. For details, see linespec.


Size of the marker in points, a strictly positive scalar. One point is 1/72 inch.

Output Arguments


Vector of handles to lines or patches in the plot.


expand all

Create a leverage plot of a fitted nonlinear model, and find the points with high leverage.

Load the reaction data and fit a model of the reaction rate as a function of reactants.

load reaction
mdl = fitnlm(reactants,rate,@hougen,[1 .05 .02 .1 2]);

Create a leverage plot of the fitted model.


To examine the observation with high leverage, activate the Data Cursor and click the observation.

Alternatively, find the high-leverage observation at the command line.

find(mdl.Diagnostics.Leverage > 0.8)
ans =



expand all


  • 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.


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

Was this topic helpful?