NAG Library Routine Document

g02hff  (robustm_user_varmat)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

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

2
Specification

Fortran Interface
Subroutine g02hff ( psi, psp, indw, indc, sigma, n, m, x, ldx, rs, wgt, c, ldc, wk, ifail)
Integer, Intent (In):: indw, indc, n, m, ldx, ldc
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), External:: psi, psp
Real (Kind=nag_wp), Intent (In):: sigma, x(ldx,m), rs(n), wgt(n)
Real (Kind=nag_wp), Intent (Inout):: c(ldc,m)
Real (Kind=nag_wp), Intent (Out):: wk(m*(n+m+1)+2*n)
C Header Interface
#include nagmk26.h
void  g02hff_ (
double (NAG_CALL *psi)( const double *t),
double (NAG_CALL *psp)( const double *t),
const Integer *indw, const Integer *indc, const double *sigma, const Integer *n, const Integer *m, const double x[], const Integer *ldx, const double rs[], const double wgt[], double c[], const Integer *ldc, double wk[], Integer *ifail)

3
Description

For a description of bounded influence regression see g02hdf. Let θ be the regression arguments and let C be the asymptotic variance-covariance matrix of θ^. Then for Huber type regression
C=fHXTX-1σ^2,  
where
fH=1n-m i= 1nψ2 ri/σ^ 1nψ riσ^ 2 κ2  
κ2=1+mn 1n i=1n ψ ri/σ^-1ni=1nψ ri/σ^ 2 1n i=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 g02hff:
1. Average over the ri 
Schweppe Mallows Di=1nj=1nψ rjσ^wi wi Di=1nj=1nψ rjσ^ wi Pi=1nj=1nψ2 rjσ^wi wi2 Pi=1nj=1nψ2 rjσ^ wi2  
2. Replace expected value by observed
Schweppe Mallows Di=ψ riσ ^wi wi Di=ψ riσ ^ wi Pi=ψ2 riσ ^wi wi2 Pi=ψ2 riσ ^ wi2  
See Hampel et al. (1986) and Marazzi (1987).
In all cases σ^ is a robust estimate of σ.
g02hff is based on routines in ROBETH; see Marazzi (1987).

4
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

5
Arguments

1:     psi – real (Kind=nag_wp) Function, supplied by the user.External Procedure
psi must return the value of the ψ function for a given value of its argument.
The specification of psi is:
Fortran Interface
Function psi ( t)
Real (Kind=nag_wp):: psi
Real (Kind=nag_wp), Intent (In):: t
C Header Interface
#include nagmk26.h
double  psi ( const double *t)
1:     t – Real (Kind=nag_wp)Input
On entry: the argument for which psi must be evaluated.
psi must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which g02hff is called. Arguments denoted as Input must not be changed by this procedure.
Note: psi should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by g02hff. If your code inadvertently does return any NaNs or infinities, g02hff is likely to produce unexpected results.
2:     psp – real (Kind=nag_wp) Function, supplied by the user.External Procedure
psp must return the value of ψt=ddt ψt for a given value of its argument.
The specification of psp is:
Fortran Interface
Function psp ( t)
Real (Kind=nag_wp):: psp
Real (Kind=nag_wp), Intent (In):: t
C Header Interface
#include nagmk26.h
double  psp ( const double *t)
1:     t – Real (Kind=nag_wp)Input
On entry: the argument for which psp must be evaluated.
psp must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which g02hff is called. Arguments denoted as Input must not be changed by this procedure.
Note: psp should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by g02hff. If your code inadvertently does return any NaNs or infinities, g02hff is likely to produce unexpected results.
3:     indw – IntegerInput
On entry: the type of regression for which the asymptotic variance-covariance matrix is to be calculated.
indw<0
Mallows type regression.
indw=0
Huber type regression.
indw>0
Schweppe type regression.
4:     indc – IntegerInput
On entry: if indw0, indc must specify the approximation to be used.
If indc=1, averaging over residuals.
If indc1 , replacing expected by observed.
If indw=0, indc is not referenced.
5:     sigma – Real (Kind=nag_wp)Input
On entry: the value of σ^, as given by g02hdf.
Constraint: sigma>0.0.
6:     n – IntegerInput
On entry: n, the number of observations.
Constraint: n>1.
7:     m – IntegerInput
On entry: m, the number of independent variables.
Constraint: 1m<n.
8:     xldxm – Real (Kind=nag_wp) arrayInput
On entry: the values of the X matrix, i.e., the independent variables. xij must contain the ijth element of X, for i=1,2,,n and j=1,2,,m.
9:     ldx – IntegerInput
On entry: the first dimension of the array x as declared in the (sub)program from which g02hff is called.
Constraint: ldxn.
10:   rsn – Real (Kind=nag_wp) arrayInput
On entry: the residuals from the bounded influence regression. These are given by g02hdf.
11:   wgtn – Real (Kind=nag_wp) arrayInput
On entry: if indw0, wgt must contain the vector of weights used by the bounded influence regression. These should be used with g02hdf.
If indw=0, wgt is not referenced.
12:   cldcm – Real (Kind=nag_wp) arrayOutput
On exit: the estimate of the variance-covariance matrix.
13:   ldc – IntegerInput
On entry: the first dimension of the array c as declared in the (sub)program from which g02hff is called.
Constraint: ldcm.
14:   wkm×n+m+1+2×n – Real (Kind=nag_wp) arrayOutput
On exit: if indw0, wki, for i=1,2,,n, will contain the diagonal elements of the matrix D and wki, for i=n+1,,2n, will contain the diagonal elements of matrix P.
The rest of the array is used as workspace.
15:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1​ or ​1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, m=value.
Constraint: m1.
On entry, m=value and ldc=value.
Constraint: ldcm.
On entry, n=value.
Constraint: n2.
On entry, n=value and ldx=value.
Constraint: ldxn.
On entry, n=value and m=value.
Constraint: n>m.
ifail=2
On entry, sigma=value.
Constraint: sigma0.0.
ifail=3
S1 matrix is singular or almost singular.
XTX matrix not positive definite.
ifail=4
Either the value of 1ni=1nψ riσ^=0,
or κ=0,
or i=1nψ2 riσ^=0.
In this situation g02hff returns C as XTX-1.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

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

8
Parallelism and Performance

g02hff is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g02hff makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
Further Comments

g02hff 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.

10
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.

10.1
Program Text

Program Text (g02hffe.f90)

10.2
Program Data

Program Data (g02hffe.d)

10.3
Program Results

Program Results (g02hffe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017