g02fa calculates two types of standardized residuals and two measures of influence for a linear regression.

Syntax

C#
public static void g02fa(
	int n,
	int ip,
	int nres,
	double[] res,
	double[] h,
	double rms,
	double[,] sres,
	out int ifail
)
Visual Basic
Public Shared Sub g02fa ( _
	n As Integer, _
	ip As Integer, _
	nres As Integer, _
	res As Double(), _
	h As Double(), _
	rms As Double, _
	sres As Double(,), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g02fa(
	int n, 
	int ip, 
	int nres, 
	array<double>^ res, 
	array<double>^ h, 
	double rms, 
	array<double,2>^ sres, 
	[OutAttribute] int% ifail
)
F#
static member g02fa : 
        n : int * 
        ip : int * 
        nres : int * 
        res : float[] * 
        h : float[] * 
        rms : float * 
        sres : float[,] * 
        ifail : int byref -> unit 

Parameters

n
Type: System..::..Int32
On entry: n, the number of observations included in the regression.
Constraint: n>ip+1.
ip
Type: System..::..Int32
On entry: p, the number of linear parameters estimated in the regression model.
Constraint: ip1.
nres
Type: System..::..Int32
On entry: the number of residuals.
Constraint: 1nresn.
res
Type: array<System..::..Double>[]()[][]
An array of size [nres]
On entry: the residuals, ri.
h
Type: array<System..::..Double>[]()[][]
An array of size [nres]
On entry: the diagonal elements of H, hi, corresponding to the residuals in res.
Constraint: 0.0<h[i]<1.0, for i=0,1,,nres-1.
rms
Type: System..::..Double
On entry: the estimate of σ2 based on all n observations, s2, i.e., the residual mean square.
Constraint: rms>0.0.
sres
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, 4]
Note: dim1 must satisfy the constraint: dim1nres
On exit: the standardized residuals and influence statistics.
For the observation with residual, ri, given in res[i-1].
sres[i-1,0]
Is the internally standardized residual, RIi.
sres[i-1,1]
Is the externally standardized residual, REi.
sres[i-1,2]
Is Cook's D statistic, Di.
sres[i-1,3]
Is Atkinson's T statistic, Ti.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

For the general linear regression model
y=Xβ+ε,
where y is a vector of length n of the dependent variable,
X is an n by p matrix of the independent variables,
β is a vector of length p of unknown parameters,
and ε is a vector of length n of unknown random errors such that varε=σ2I.
The residuals are given by
r=y-y^=y-Xβ^
and the fitted values, y^=Xβ^, can be written as Hy for an n by n matrix H. The ith diagonal elements of H, hi, give a measure of the influence of the ith values of the independent variables on the fitted regression model. The values of r and the hi are returned by g02da.
g02fa 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:
(i) The ith residual is standardized by its variance when the estimate of σ2, s2, is calculated from all the data; this is known as internal Studentization.
RIi=ris1-hi.
(ii) The ith residual is standardized by its variance when the estimate of σ2, s-i2 is calculated from the data excluding the ith observation; this is known as external Studentization.
REi=ris-i1-hi=rin-p-1n-p-RIi2.
The two measures of influence are:
(i) Cook's D 
Di=1pREi2hi1-hi.
(ii) Atkinson's T 
Ti=REin-pphi1-hi.

References

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

Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDSRES) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
ifail=1
On entry,ip<1,
ornip+1,
ornres<1,
ornres>n,
orrms0.0.
ifail=2
On entry,h[i-1]0.0 or 1.0, for some i=1,2,,nres.
ifail=3
On entry,the value of a residual is too large for the given value of rms.
ifail=-9000
An error occured, see message report.
ifail=-6000
Invalid Parameters value
ifail=-4000
Invalid dimension for array value
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

Accuracy is sufficient for all practical purposes.

Parallelism and Performance

None.

Further Comments

None.

Example

A set of 24 residuals and hi values from a 11 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 10 observations.

Example program (C#): g02fae.cs

Example program data: g02fae.d

Example program results: g02fae.r

See Also