plotDiagnostics(mdl)
plotDiagnostics(mdl,plottype)
h = plotDiagnostics(...)
h = plotDiagnostics(mdl,plottype,Name,Value)
plotDiagnostics(
plots
diagnostics from the mdl
)mdl
linear model using leverage
as the plot type.
plotDiagnostics(
plots
diagnostics from the mdl
,plottype
)mdl
generalized linear model
in a plot of type plottype
.
returns
handles to the lines in the plot.h
= plotDiagnostics(...)
plots
with additional options specified by one or more h
= plotDiagnostics(mdl
,plottype
,Name,Value
)Name,Value
pair
arguments.
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.

Generalized linear model, as constructed by  

Character vector specifying the type of plot:
Default: 
Specify optional commaseparated 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
.
Note:
The plot property namevalue pairs apply to the first returned
handle 

Color of the line or marker, a 

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

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

Color of the marker or edge color for filled markers, a 

Color of the marker face for filled markers, a 

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

Vector of handles to lines or patches in the plot. 
The hat matrix H is defined in terms of the data matrix X and a diagonal weight matrix W:
H = X(X^{T}WX)^{–1}X^{T}W^{T}.
W has diagonal elements w_{i}:
$${w}_{i}=\frac{{g}^{\prime}\left({\mu}_{i}\right)}{\sqrt{V\left({\mu}_{i}\right)}},$$
where
g is the link function mapping y_{i} to x_{i}b.
$${g}^{\prime}$$ is the derivative of the link function g.
V is the variance function.
μ_{i} is the ith mean.
The diagonal elements H_{ii} satisfy
$$\begin{array}{l}0\le {h}_{ii}\le 1\\ {\displaystyle \sum _{i=1}^{n}{h}_{ii}}=p,\end{array}$$
where n is the number of observations (rows of X), and p is the number of coefficients in the regression model.
The leverage of observation i is the value of the ith diagonal term, h_{ii}, of the hat matrix H. Because the sum of the leverage values is p (the number of coefficients in the regression model), an observation i can be considered to be an outlier if its leverage substantially exceeds p/n, where n is the number of observations.
The Cook's distance D_{i} of observation i is
$${D}_{i}={w}_{i}\frac{{e}_{i}^{2}}{p\widehat{\phi}}\frac{{h}_{ii}}{{\left(1{h}_{ii}\right)}^{2}},$$
where
$$\widehat{\phi}$$ is the dispersion parameter (estimated or theoretical).
e_{i} is the linear predictor residual, $$g\left({y}_{i}\right){x}_{i}\widehat{\beta}$$, where
g is the link function.
y_{i} is the observed response.
x_{i} is the observation.
$$\widehat{\beta}$$ is the estimated coefficient vector.
p is the number of coefficients in the regression model.
h_{ii} is the ith diagonal element of the Hat Matrix H.
[1] Neter, J., M. H. Kutner, C. J. Nachtsheim, and W. Wasserman. Applied Linear Statistical Models, Fourth Edition. Irwin, Chicago, 1996.