NAG Library Routine Document
G02FAF calculates two types of standardized residuals and two measures of influence for a linear regression.
||N, IP, NRES, LDSRES, IFAIL
||RES(NRES), H(NRES), RMS, SRES(LDSRES,4)
For the general linear regression model
|| is a vector of length of the dependent variable,
|| is an by matrix of the independent variables,
|| is a vector of length of unknown parameters,
|| is a vector of length of unknown random errors such that .
The residuals are given by
and the fitted values,
, can be written as
th diagonal elements of
, give a measure of the influence of the
th values of the independent variables on the fitted regression model. The values of
are returned by G02DAF
G02FAF 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 th residual is standardized by its variance when the estimate of , , is calculated from all the data; this is known as internal Studentization.
||The th residual is standardized by its variance when the estimate of , is calculated from the data excluding the th observation; this is known as external Studentization.
The two measures of influence are:
Atkinson A C (1981) Two graphical displays for outlying and influential observations in regression Biometrika 68 13–20
Cook R D and Weisberg S (1982) Residuals and Influence in Regression Chapman and Hall
- 1: N – INTEGERInput
On entry: , the number of observations included in the regression.
- 2: IP – INTEGERInput
On entry: , the number of linear parameters estimated in the regression model.
- 3: NRES – INTEGERInput
On entry: the number of residuals.
- 4: RES(NRES) – REAL (KIND=nag_wp) arrayInput
On entry: the residuals, .
- 5: H(NRES) – REAL (KIND=nag_wp) arrayInput
: the diagonal elements of
, corresponding to the residuals in RES
, for .
- 6: RMS – REAL (KIND=nag_wp)Input
On entry: the estimate of based on all observations, , i.e., the residual mean square.
- 7: SRES(LDSRES,) – REAL (KIND=nag_wp) arrayOutput
: the standardized residuals and influence statistics.
For the observation with residual,
, given in
- Is the internally standardized residual, .
- Is the externally standardized residual, .
- Is Cook's statistic, .
- Is Atkinson's statistic, .
- 8: LDSRES – INTEGERInput
: the first dimension of the array SRES
as declared in the (sub)program from which G02FAF is called.
- 9: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
|On entry,|| or , for some .|
|On entry,||the value of a residual is too large for the given value of RMS.|
Accuracy is sufficient for all practical purposes.
A set of
values from a
parameter model fitted to the cloud seeding data considered in Cook and Weisberg (1982)
are input and the standardized residuals etc calculated and printed for the first
9.1 Program Text
Program Text (g02fafe.f90)
9.2 Program Data
Program Data (g02fafe.d)
9.3 Program Results
Program Results (g02fafe.r)