g02hb finds, for a real matrix X of full column rank, a lower triangular matrix A such that ATA-1 is proportional to a robust estimate of the covariance of the variables. g02hb is intended for the calculation of weights of bounded influence regression using g02hd.

Syntax

C#
public static void g02hb(
	G02..::..G02HB_UCV ucv,
	int n,
	int m,
	double[,] x,
	double[] a,
	double[] z,
	double bl,
	double bd,
	double tol,
	int maxit,
	int nitmon,
	out int nit,
	out int ifail
)
Visual Basic
Public Shared Sub g02hb ( _
	ucv As G02..::..G02HB_UCV, _
	n As Integer, _
	m As Integer, _
	x As Double(,), _
	a As Double(), _
	z As Double(), _
	bl As Double, _
	bd As Double, _
	tol As Double, _
	maxit As Integer, _
	nitmon As Integer, _
	<OutAttribute> ByRef nit As Integer, _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g02hb(
	G02..::..G02HB_UCV^ ucv, 
	int n, 
	int m, 
	array<double,2>^ x, 
	array<double>^ a, 
	array<double>^ z, 
	double bl, 
	double bd, 
	double tol, 
	int maxit, 
	int nitmon, 
	[OutAttribute] int% nit, 
	[OutAttribute] int% ifail
)
F#
static member g02hb : 
        ucv : G02..::..G02HB_UCV * 
        n : int * 
        m : int * 
        x : float[,] * 
        a : float[] * 
        z : float[] * 
        bl : float * 
        bd : float * 
        tol : float * 
        maxit : int * 
        nitmon : int * 
        nit : int byref * 
        ifail : int byref -> unit 

Parameters

ucv
Type: NagLibrary..::..G02..::..G02HB_UCV
ucv must return the value of the function u for a given value of its argument. The value of u must be non-negative.

A delegate of type G02HB_UCV.

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: 1mn.
x
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, m]
Note: dim1 must satisfy the constraint: dim1n
On entry: the real matrix X, 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.
a
Type: array<System..::..Double>[]()[][]
An array of size [m×m+1/2]
On entry: an initial estimate of the lower triangular real matrix A. Only the lower triangular elements must be given and these should be stored row-wise in the array.
The diagonal elements must be 0, although in practice will usually be >0. If the magnitudes of the columns of X are of the same order the identity matrix will often provide a suitable initial value for A. If the columns of X are of different magnitudes, the diagonal elements of the initial value of A should be approximately inversely proportional to the magnitude of the columns of X.
On exit: the lower triangular elements of the matrix A, stored row-wise.
z
Type: array<System..::..Double>[]()[][]
An array of size [n]
On exit: the value zi2, for i=1,2,,n.
bl
Type: System..::..Double
On entry: the magnitude of the bound for the off-diagonal elements of Sk.
Suggested value: bl=0.9.
Constraint: bl>0.0.
bd
Type: System..::..Double
On entry: the magnitude of the bound for the diagonal elements of Sk.
Suggested value: bd=0.9.
Constraint: bd>0.0.
tol
Type: System..::..Double
On entry: the relative precision for the final value of A. Iteration will stop when the maximum value of sjl is less than tol.
Constraint: tol>0.0.
maxit
Type: System..::..Int32
On entry: the maximum number of iterations that will be used during the calculation of A.
A value of maxit=50 will often be adequate.
Constraint: maxit>0.
nitmon
Type: System..::..Int32
On entry: determines the amount of information that is printed on each iteration.
nitmon>0
The value of A and the maximum value of sjl will be printed at the first and every nitmon iterations.
nitmon0
No iteration monitoring is printed.
When printing occurs the output is directed to the current advisory message unit (see (X04ABF not in this release)).
nit
Type: System..::..Int32%
On exit: the number of iterations performed.
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

In fitting the linear regression model
y=Xθ+ε,
where y is a vector of length n of the dependent variable,
X is an n by m matrix of independent variables,
θ is a vector of length m of unknown parameters,
and ε is a vector of length n of unknown errors,
it may be desirable to bound the influence of rows of the X matrix. This can be achieved by calculating a weight for each observation. Several schemes for calculating weights have been proposed (see Hampel et al. (1986) and Marazzi (1987)). As the different independent variables may be measured on different scales one group of proposed weights aims to bound a standardized measure of influence. To obtain such weights the matrix A has to be found such that
1ni=1nuzi2ziziT=I​  I​ is the identity matrix
and
zi=Axi,
where xi is a vector of length m containing the elements of the ith row of X,
A is an m by m lower triangular matrix,
zi is a vector of length m,
and u is a suitable function.
The weights for use with g02hd may then be computed using
wi=fzi2
for a suitable user-supplied function f.
g02hb finds A using the iterative procedure
Ak=Sk+IAk-1,
where Sk=sjl, for j=1,2,,m and l=1,2,,m, is a lower triangular matrix such that
  • sjl=-minmaxhjl/n,-BL,BL,j>l-minmax12hjj/n-1,-BD,BD,j=l
  • hjl=i=1nuzi2zijzil
and BD and BL are suitable bounds.
In addition the values of zi2, for i=1,2,,n, are calculated.
g02hb 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) Weights for bounded influence regression in ROBETH Cah. Rech. Doc. IUMSP, No. 3 ROB 3 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) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
ifail=1
On entry,n1,
orm<1,
orn<m,
ifail=2
On entry,tol0.0,
ormaxit0,
ordiagonal element of a=0.0,
orbl0.0,
orbd0.0.
ifail=3
Value returned by ucv<0.
ifail=4
The method has failed to converge in maxit iterations.
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

On successful exit the accuracy of the results is related to the value of tol; see [Parameters].

Parallelism and Performance

None.

Further Comments

The existence of A will depend upon the function u; (see Hampel et al. (1986) and Marazzi (1987)), also if X is not of full rank a value of A will not be found. If the columns of X are almost linearly related then convergence will be slow.

Example

This example reads in a matrix of real numbers and computes the Krasker–Welsch weights (see Marazzi (1987)). The matrix A and the weights are then printed.

Example program (C#): g02hbe.cs

Example program data: g02hbe.d

Example program results: g02hbe.r

See Also