|
NAG[g02fac] NAG[nag_regsn_std_resid_influence] - Calculates standardized residuals and influence statistics
|
|
Calling Sequence
g02fac(n, ip, res, h, rms, sres, 'nres'=nres, 'fail'=fail)
nag_regsn_std_resid_influence(. . .)
Parameters
|
n - integer;
|
|
|
On entry: number of observations included in the regression, .
|
|
Constraint: . .
|
|
|
ip - integer;
|
|
|
On entry: the number of linear arguments estimated in the regression model, .
|
|
Constraint: . .
|
|
|
res - Vector(1..nres, datatype=float[8]);
|
|
|
On entry: the residuals, .
|
|
|
h - Vector(1..nres, datatype=float[8]);
|
|
|
On entry: the diagonal elements of , , corresponding to the residuals in res.
|
|
Constraint: , for . .
|
|
|
rms - float;
|
|
|
Constraint: . .
|
|
|
sres - Matrix(1..nres, 1.., datatype=float[8], order=C_order);
|
|
|
On exit: the standardized residuals and influence statistics.
|
|
For the observation with residual given in :
|
|
is the internally studentized residual
|
|
is the externally studentized residual
|
|
is Cook's statistic
|
|
is Atkinson's statistic.
|
|
|
'nres'=nres - integer; (optional)
|
|
|
Default value: the first dimension of the arrays res, h, sres.
|
|
On entry: the number of residuals.
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_regsn_std_resid_influence (g02fac) calculates two types of standardized residuals and two measures of influence for a linear regression.
|
|
Description
|
|
For the general linear regression model is defined by
where
|
|
is a vector of length of the dependent variable,
|
|
|
is an by matrix of the independent variables,
|
|
|
is a vector of length of unknown arguments,
|
and
|
|
is a vector of length of unknown random errors such that .
|
|
|
The residuals are given by
The fitted values, , can be written as for an by matrix . The th diagonal element of , , gives a measure of the influence of the th value of the independent variables on the fitted regression model. The values of and the are returned by g02dac (nag_regsn_mult_linear).
nag_regsn_std_resid_influence (g02fac) calculates statistics which help to indicate if an observation is extreme and having an undue influence on the fit of the regression model. Two types of standardized residual are calculated:
The two measures of influence are:
|
a. Cook's
|
|
b. Atkinson's
|
|
|
Error Indicators and Warnings
|
|
"NE_2_INT_ARG_GT"
On entry, while . These arguments must satisfy .
"NE_2_INT_ARG_LE"
On entry, while . These arguments must satisfy .
"NE_INT_ARG_LT"
On entry, ip must not be less than 1: .
"NE_REAL_ARG_GE"
On entry, must not be greater than or equal to 1.0: .
"NE_REAL_ARG_LE"
On entry, rms must not be less than or equal to 0.0: .
"NE_RESID_LARG"
On entry, the value of a residual is too large for the given value of rms: , .
|
|
Accuracy
|
|
Accuracy is sufficient for all practical purposes.
|
|
|
Examples
|
|
>
|
n := 24:
ip := 11:
nres := 10:
rms := 0.5798:
res := Vector([0.266, -0.1387, -0.2971, 0.5926, -0.4013, 0.1396, -1.3173, 1.1226, 0.0321, -0.7111], datatype=float[8]):
h := Vector([0.5518999999999999, 0.9746, 0.6256, 0.3144, 0.4106, 0.6268, 0.5479000000000001, 0.2325, 0.4115, 0.3577], datatype=float[8]):
sres := Matrix(10, 4, datatype=float[8], order='C_order'):
NAG:-g02fac(n, ip, res, h, rms, sres, 'nres' = nres):
|
|
|