Compute Regression Diagnostics

DESCRIPTION:
Returns a list containing several quantities for assessing the fit (from lsfit) of a least squares regression model including the standard deviation of the residuals, studentized residuals, and the standard errors of the parameter estimates.

USAGE:
ls.diag(ls.out)

REQUIRED ARGUMENTS:
ls.out:
a list like the output from lsfit.

VALUE:
a list with the following components:
std.dev:
residual standard deviation (for each column of the response if it was a matrix). This is the square root of the quantity: the residual sum of squares divided by the degrees of freedom. The degrees of freedom are the number of non-missing observations minus the number of parameters.
hat:
vector containing the diagonal of the hat matrix (see the hat function).
std.res:
vector or matrix containing the standardized residuals. This uses hat and std.dev to standardize the residuals.
stud.res:
vector or matrix containing the studentized residuals. This uses hat and a different estimate of the standard deviation.
cooks:
vector or matrix containing Cook's distance for each observation. The element in the i-th row and j-th column is the measure of the distance between the parameter estimates for the j-th regression with and without the i-th observation.
dfits:
vector or matrix containing the change in the fitted value when each observation is deleted, This is called DFFITS in Belsley et al. (1980). The i-th element or row is the scaled difference in fit with and without the i-th observation.
correlation:
correlation matrix for the parameter estimates.
std.err:
vector or matrix of the standard errors of the parameter estimates.
cov.unscaled:
unscaled covariance matrix for the parameter estimates. This is equal to solve(t(x)%*%x), where x is the matrix of explanatory variables for the non-missing observations. The cov.unscaled matrix should be multiplied by the residual variance (an element of std.dev^2) in order to scale it for a particular y-value.

NOTE:
This function replaces the ls.summary function in New S from AT&T. If you type ls.summary a warning will be given and ls.diag will be used.

DETAILS:
An observation is considered to be missing in the multivariate case if any of the residuals for that observation is missing. If there are weights, the residuals used are the raw residuals multiplied by the square root of the weights.

The studentized residuals stud.res are very similar to the standardized residuals except that for each observation a different estimate of the standard deviation is used - the estimate as if that observation were not in the regression. See Belsley, Kuh and Welsch (1980, p 14).


REFERENCES:
Belsley, D. A., Kuh, E. and Welsch, R. E. (1980). Regression Diagnostics. Wiley, New York.

Cook, R. D. and Weisberg, S. (1982). Residuals and Influence in Regression. Chapman and Hall, New York.


SEE ALSO:
lsfit , hat , ls.print .

EXAMPLES:
freeny.ls <- lsfit(freeny.x, freeny.y)
freeny.diag <- ls.diag(freeny.ls)