NAG Library Function Document
nag_robust_m_regsn_param_var (g02hfc)
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
be the asymptotic variance-covariance matrix of
. Then for Huber type regression
where
see
Huber (1981) and
Marazzi (1987).
For Mallows and Schweppe type regressions,
is of the form
where
and
.
is a diagonal matrix such that the th element approximates in the Schweppe case and in the Mallows case.
is a diagonal matrix such that the th element approximates in the Schweppe case and in the Mallows case.
Two approximations are available in nag_robust_m_regsn_param_var (g02hfc):
1. |
Average over the
|
2. |
Replace expected value by observed
|
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:
order – Nag_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
. See
Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint:
or .
- 2:
psi – function, 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:
t – doubleInput
On entry: the argument for which
psi must be evaluated.
- 2:
comm – Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to
psi.
- user – double *
- iuser – Integer *
- p – Pointer
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:
psp – function, supplied by the userExternal Function
psp must return the value of
for a given value of its argument.
The specification of
psp is:
double |
psp (double t,
Nag_Comm *comm)
|
|
- 1:
t – doubleInput
On entry: the argument for which
psp must be evaluated.
- 2:
comm – Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to
psp.
- user – double *
- iuser – Integer *
- p – Pointer
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:
regtype – Nag_RegTypeInput
On entry: the type of regression for which the asymptotic variance-covariance matrix is to be calculated.
-
- Mallows type regression.
- Huber type regression.
-
- Schweppe type regression.
Constraint:
, or .
- 5:
covmat_est – Nag_CovMatrixEstInput
On entry: if
,
covmat_est must specify the approximation to be used.
If , averaging over residuals.
If , replacing expected by observed.
If
,
covmat_est is not referenced.
Constraint:
or .
- 6:
sigma – doubleInput
On entry: the value of
, as given by
nag_robust_m_regsn_user_fn (g02hdc).
Constraint:
.
- 7:
n – IntegerInput
On entry: , the number of observations.
Constraint:
.
- 8:
m – IntegerInput
On entry: , the number of independent variables.
Constraint:
.
- 9:
x[] – const doubleInput
-
Note: the dimension,
dim, of the array
x
must be at least
- when ;
- when .
Where
appears in this document, it refers to the array element
- when ;
- when .
On entry: the values of the matrix, i.e., the independent variables.
must contain the th element of , for and .
- 10:
pdx – IntegerInput
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
x.
Constraints:
- if ,
;
- if , .
- 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
,
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
,
wgt is not referenced.
- 13:
cov[] – doubleOutput
-
Note: the dimension,
dim, of the array
cov
must be at least
.
The
th element of the matrix is stored in
- when ;
- when .
On exit: the estimate of the variance-covariance matrix.
- 14:
pdc – IntegerInput
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
cov.
Constraint:
.
- 15:
comm_arr[] – doubleOutput
-
Note: the dimension,
dim, of the array
comm_arr
must be at least
.
On exit: if ,
, for , will contain the diagonal elements of the matrix and
, for , will contain the diagonal elements of matrix .
- 16:
comm – Nag_Comm *Communication Structure
-
The NAG communication argument (see
Section 3.2.1.1 in the Essential Introduction).
- 17:
fail – NagError *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 had an illegal value.
- NE_CORRECTION_FACTOR
-
Correction factor = 0 (Huber type regression).
- NE_INT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_2
-
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
- 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
-
matrix not positive definite.
- NE_REAL
-
On entry, .
Constraint: .
- NE_SINGULAR
-
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.
nag_robust_m_regsn_param_var (g02hfc) is only for situations in which has full column rank.
Care has to be taken in the choice of the function since if for too wide a range then either the value of will not exist or too many values of will be zero and it will not be possible to calculate .
10 Example
The asymptotic variance-covariance matrix is calculated for a Schweppe type regression. The values of , 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)