Statistics Toolbox | ![]() ![]() |
Regression diagnostics for linear models
Syntax
Description
regstats(responses,data,'
fits a multiple regression of the measurements in the vector, model
')
responses
, on the values in the matrix, DATA
. The function creates a UI that displays a group of checkboxes that save diagnostic statistics to the base workspace using specified variable names. 'model
' controls the order of the regression model. By default, regstats
uses a linear additive model with a constant term.
'model
' can be one of the following strings
The order of the coefficients is the order defined by the x2fx
function.
stats = regstats(responses,DATA,model,
creates an output structure whichstats
)
stats
containing the statistics listed in '
whichstats
'
. '
whichstats
'
can be a single name such as 'leverage'
or a cell array of names such as {'leverage' 'standres' 'studres'}
. Valid names are:
For more detail press the Help button in the regstats
window. This provides formulae and interpretations for each of these regression diagnostics.
Algorithm
The usual regression model is y = X +
, where:
Let X
= Q*R
where Q
and R
come from a QR Decomposition of X
. Q
is orthogonal and R
is triangular. Both of these matrices are useful for calculating many regression diagnostics (Goodall 1993).
The standard textbook equation for the least squares estimator of is
However, this definition has poor numeric properties. Particularly dubious is the computation of , which is both expensive and imprecise.
Numerically stable MATLAB code for is
See Also
leverage
, stepwise
, regress
Reference
[1] Belsley, D.A., E. Kuh, and R.E. Welsch , Regression Diagnostics, New York: Wiley, 1980.
[2] Cook, R.D., and S. Weisberg, Residuals and Influence in Regression, New York: Wiley, 1982.
[3] Goodall, C. R., "Computation using the QR decomposition," Statistical Computing (C. R. Rao, ed.), Handbook in Statistics, Volume 9. Amsterdam, NL Elsevier/North-Holland, 1993.
![]() | regress | ridge | ![]() |