g02hf calculates an estimate of the asymptotic variance-covariance matrix for the bounded influence regression estimates (M-estimates). It is intended for use with g02hd.

Syntax

C#
public static void g02hf(
	G02..::..G02HF_PSI psi,
	G02..::..G02HF_PSP psp,
	int indw,
	int indc,
	double sigma,
	int n,
	int m,
	double[,] x,
	double[] rs,
	double[] wgt,
	double[,] c,
	double[] diag_d,
	double[] diag_p,
	out int ifail
)
Visual Basic
Public Shared Sub g02hf ( _
	psi As G02..::..G02HF_PSI, _
	psp As G02..::..G02HF_PSP, _
	indw As Integer, _
	indc As Integer, _
	sigma As Double, _
	n As Integer, _
	m As Integer, _
	x As Double(,), _
	rs As Double(), _
	wgt As Double(), _
	c As Double(,), _
	diag_d As Double(), _
	diag_p As Double(), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g02hf(
	G02..::..G02HF_PSI^ psi, 
	G02..::..G02HF_PSP^ psp, 
	int indw, 
	int indc, 
	double sigma, 
	int n, 
	int m, 
	array<double,2>^ x, 
	array<double>^ rs, 
	array<double>^ wgt, 
	array<double,2>^ c, 
	array<double>^ diag_d, 
	array<double>^ diag_p, 
	[OutAttribute] int% ifail
)
F#
static member g02hf : 
        psi : G02..::..G02HF_PSI * 
        psp : G02..::..G02HF_PSP * 
        indw : int * 
        indc : int * 
        sigma : float * 
        n : int * 
        m : int * 
        x : float[,] * 
        rs : float[] * 
        wgt : float[] * 
        c : float[,] * 
        diag_d : float[] * 
        diag_p : float[] * 
        ifail : int byref -> unit 

Parameters

psi
Type: NagLibrary..::..G02..::..G02HF_PSI
psi must return the value of the ψ function for a given value of its argument.

A delegate of type G02HF_PSI.

psp
Type: NagLibrary..::..G02..::..G02HF_PSP
psp must return the value of ψt=ddtψt for a given value of its argument.

A delegate of type G02HF_PSP.

indw
Type: System..::..Int32
On entry: the type of regression for which the asymptotic variance-covariance matrix is to be calculated.
indw=-1
Mallows type regression.
indw=0
Huber type regression.
indw=1
Schweppe type regression.
indc
Type: System..::..Int32
On entry: if indw0, indc must specify the approximation to be used.
If indc=1, averaging over residuals.
If indc=0, replacing expected by observed.
If indw=0, indc is not referenced.
sigma
Type: System..::..Double
On entry: the value of σ^, as given by g02hd.
Constraint: sigma>0.0.
n
Type: System..::..Int32
On entry: n, the number of observations.
Constraint: n>1.
m
Type: System..::..Int32
On entry: m, the number of independent variables.
Constraint: 1m<n.
x
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, m]
Note: dim1 must satisfy the constraint: dim1n
On entry: the values of the X matrix, i.e., the independent variables. x[i-1,j-1] must contain the ijth element of X, for i=1,2,,n and j=1,2,,m.
rs
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: the residuals from the bounded influence regression. These are given by g02hd.
wgt
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: if indw0, wgt must contain the vector of weights used by the bounded influence regression. These should be used with g02hd.
If indw=0, wgt is not referenced.
c
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, m]
Note: dim1 must satisfy the constraint: dim1m
On exit: the estimate of the variance-covariance matrix.
diag_d
Type: array<System..::..Double>[]()[][]
An array of size [n]
On exit: diag_d will contain the diagonal elements of the matrix _d
diag_p
Type: array<System..::..Double>[]()[][]
An array of size [n]
On exit: diag_p will contain the diagonal elements of the matrix _p
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 a description of bounded influence regression see g02hd. Let θ be the regression parameters and let C be the asymptotic variance-covariance matrix of θ^. Then for Huber type regression
C=fHXTX-1σ^2,
where
fH=1n-mi=1nψ2ri/σ^1nψriσ^2κ2
κ2=1+mn1ni=1nψri/σ^-1ni=1nψri/σ^21ni=1nψriσ^2,
see Huber (1981) and Marazzi (1987).
For Mallows and Schweppe type regressions, C is of the form
σ^n2S1-1S2S1-1,
where S1=1nXTDX and S2=1nXTPX.
D is a diagonal matrix such that the ith element approximates Eψri/σwi in the Schweppe case and Eψri/σwi in the Mallows case.
P is a diagonal matrix such that the ith element approximates Eψ2ri/σwiwi2 in the Schweppe case and Eψ2ri/σwi2 in the Mallows case.
Two approximations are available in g02hf:
1. Average over the ri 
SchweppeMallowsDi=1nj=1nψrjσ^wiwiDi=1nj=1nψrjσ^wiPi=1nj=1nψ2rjσ^wiwi2Pi=1nj=1nψ2rjσ^wi2
2. Replace expected value by observed
SchweppeMallowsDi=ψriσ^wiwiDi=ψriσ^wiPi=ψ2riσ^wiwi2Pi=ψ2riσ^wi2
In all cases σ^ is a robust estimate of σ.
g02hf is based on routines in ROBETH; see Marazzi (1987).

References

Hampel F R, Ronchetti E M, Rousseeuw P J and Stahel W A (1986) Robust Statistics. The Approach Based on Influence Functions Wiley
Huber P J (1981) Robust Statistics Wiley
Marazzi A (1987) Subroutines for robust and bounded influence regression in ROBETH Cah. Rech. Doc. IUMSP, No. 3 ROB 2 Institut Universitaire de Médecine Sociale et Préventive, Lausanne

Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDX, LDC, WK) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
ifail=1
On entry,n1,
orm<1,
ornm,
ifail=2
On entry,sigma0.0.
ifail=3
If indw=0 then the matrix XTX is either not positive definite, possibly due to rounding errors, or is ill-conditioned.
If indw0 then the matrix S1 is singular or almost singular. This may be due to many elements of D being zero.
ifail=4
Either the value of 1ni=1nψriσ^=0,
or κ=0,
or i=1nψ2riσ^=0.
In this situation g02hf returns C as XTX-1.
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

In general, the accuracy of the variance-covariance matrix will depend primarily on the accuracy of the results from g02hd.

Parallelism and Performance

None.

Further Comments

g02hf is only for situations in which X has full column rank.
Care has to be taken in the choice of the ψ function since if ψt=0 for too wide a range then either the value of fH will not exist or too many values of Di will be zero and it will not be possible to calculate C.

Example

The asymptotic variance-covariance matrix is calculated for a Schweppe type regression. The values of X, σ^ and the residuals and weights are read in. The averaging over residuals approximation is used.

Example program (C#): g02hfe.cs

Example program data: g02hfe.d

Example program results: g02hfe.r

See Also