nag_robust_m_regsn_param_var (g02hfc) (PDF version)
g02 Chapter Contents
g02 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_robust_m_regsn_param_var (g02hfc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

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

2  Specification

#include <nag.h>
#include <nagg02.h>
void  nag_robust_m_regsn_param_var (Nag_OrderType order,
double (*psi)(double t, Nag_Comm *comm),
double (*psp)(double t, Nag_Comm *comm),
Nag_RegType regtype, Nag_CovMatrixEst covmat_est, double sigma, Integer n, Integer m, const double x[], Integer pdx, const double rs[], const double wgt[], double cov[], Integer pdc, double comm_arr[], Nag_Comm *comm, NagError *fail)

3  Description

For a description of bounded influence regression see nag_robust_m_regsn_user_fn (g02hdc). 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 nag_robust_m_regsn_param_var (g02hfc):
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 σ.
nag_robust_m_regsn_param_var (g02hfc) 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:     orderNag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     psifunction, supplied by the userExternal Function
psi must return the value of the ψ function for a given value of its argument.
The specification of psi is:
double  psi (double t, Nag_Comm *comm)
1:     tdoubleInput
On entry: the argument for which psi must be evaluated.
2:     commNag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to psi.
userdouble *
iuserInteger *
pPointer 
The type Pointer will be void *. Before calling nag_robust_m_regsn_param_var (g02hfc) you may allocate memory and initialize these pointers with various quantities for use by psi when called from nag_robust_m_regsn_param_var (g02hfc) (see Section 3.2.1.1 in the Essential Introduction).
3:     pspfunction, supplied by the userExternal Function
psp must return the value of ψt=ddt ψt for a given value of its argument.
The specification of psp is:
double  psp (double t, Nag_Comm *comm)
1:     tdoubleInput
On entry: the argument for which psp must be evaluated.
2:     commNag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to psp.
userdouble *
iuserInteger *
pPointer 
The type Pointer will be void *. Before calling nag_robust_m_regsn_param_var (g02hfc) you may allocate memory and initialize these pointers with various quantities for use by psp when called from nag_robust_m_regsn_param_var (g02hfc) (see Section 3.2.1.1 in the Essential Introduction).
4:     regtypeNag_RegTypeInput
On entry: the type of regression for which the asymptotic variance-covariance matrix is to be calculated.
regtype=Nag_MallowsReg
Mallows type regression.
regtype=Nag_HuberReg
Huber type regression.
regtype=Nag_SchweppeReg
Schweppe type regression.
Constraint: regtype=Nag_MallowsReg, Nag_HuberReg or Nag_SchweppeReg.
5:     covmat_estNag_CovMatrixEstInput
On entry: if regtypeNag_HuberReg, covmat_est must specify the approximation to be used.
If covmat_est=Nag_CovMatAve, averaging over residuals.
If covmat_est=Nag_CovMatObs, replacing expected by observed.
If regtype=Nag_HuberReg, covmat_est is not referenced.
Constraint: covmat_est=Nag_CovMatAve or Nag_CovMatObs.
6:     sigmadoubleInput
On entry: the value of σ^, as given by nag_robust_m_regsn_user_fn (g02hdc).
Constraint: sigma>0.0.
7:     nIntegerInput
On entry: n, the number of observations.
Constraint: n>1.
8:     mIntegerInput
On entry: m, the number of independent variables.
Constraint: 1m<n.
9:     x[dim]const doubleInput
Note: the dimension, dim, of the array x must be at least
  • max1,pdx×m when order=Nag_ColMajor;
  • max1,n×pdx when order=Nag_RowMajor.
Where Xi,j appears in this document, it refers to the array element
  • x[j-1×pdx+i-1] when order=Nag_ColMajor;
  • x[i-1×pdx+j-1] when order=Nag_RowMajor.
On entry: the values of the X matrix, i.e., the independent variables. Xi,j must contain the ijth element of X, for i=1,2,,n and j=1,2,,m.
10:   pdxIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array x.
Constraints:
  • if order=Nag_ColMajor, pdxn;
  • if order=Nag_RowMajor, pdxm.
11:   rs[n]const doubleInput
On entry: the residuals from the bounded influence regression. These are given by nag_robust_m_regsn_user_fn (g02hdc).
12:   wgt[n]const doubleInput
On entry: if regtypeNag_HuberReg, wgt must contain the vector of weights used by the bounded influence regression. These should be used with nag_robust_m_regsn_user_fn (g02hdc).
If regtype=Nag_HuberReg, wgt is not referenced.
13:   cov[dim]doubleOutput
Note: the dimension, dim, of the array cov must be at least pdc×m.
The i,jth element of the matrix is stored in
  • cov[j-1×pdc+i-1] when order=Nag_ColMajor;
  • cov[i-1×pdc+j-1] when order=Nag_RowMajor.
On exit: the estimate of the variance-covariance matrix.
14:   pdcIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array cov.
Constraint: pdcm.
15:   comm_arr[dim]doubleOutput
Note: the dimension, dim, of the array comm_arr must be at least m×n+m+1+2×n.
On exit: if regtypeNag_HuberReg, comm_arr[i-1], for i=1,2,,n, will contain the diagonal elements of the matrix D and comm_arr[i-1], for i=n+1,,2n, will contain the diagonal elements of matrix P.
16:   commNag_Comm *Communication Structure
The NAG communication argument (see Section 3.2.1.1 in the Essential Introduction).
17:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_CORRECTION_FACTOR
Correction factor = 0 (Huber type regression).
NE_INT
On entry, m=value.
Constraint: m1.
On entry, n=value.
Constraint: n>1.
On entry, pdc=value.
Constraint: pdc>0.
On entry, pdx=value.
Constraint: pdx>0.
NE_INT_2
On entry, m=value and n=value.
Constraint: 1m<n.
On entry, m=value and pdc=value.
Constraint: pdcm.
On entry, n=value and m=value.
Constraint: n>m.
On entry, pdc=value and m=value.
Constraint: pdcm.
On entry, pdx=value and m=value.
Constraint: pdxm.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_POS_DEF
XTX matrix not positive definite.
NE_REAL
On entry, sigma=value.
Constraint: sigma0.0.
NE_SINGULAR
S1 matrix is singular or almost singular.

7  Accuracy

In general, the accuracy of the variance-covariance matrix will depend primarily on the accuracy of the results from nag_robust_m_regsn_user_fn (g02hdc).

8  Parallelism and Performance

nag_robust_m_regsn_param_var (g02hfc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_robust_m_regsn_param_var (g02hfc) 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 Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

nag_robust_m_regsn_param_var (g02hfc) 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 (g02hfce.c)

10.2  Program Data

Program Data (g02hfce.d)

10.3  Program Results

Program Results (g02hfce.r)


nag_robust_m_regsn_param_var (g02hfc) (PDF version)
g02 Chapter Contents
g02 Chapter Introduction
NAG Library Manual

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