NAG FL Interface
g02hff (robustm_user_varmat)
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 <nag.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) |
|
C++ Header Interface
#include <nag.h> extern "C" {
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) |
}
|
The routine may be called by the names g02hff or nagf_correg_robustm_user_varmat.
3
Description
For a description of bounded influence regression see
g02hdf. Let
be the regression parameters 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
g02hff:
-
1.Average over the
-
2.Replace expected value by observed
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:
– 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
Real (Kind=nag_wp) |
:: |
psi |
Real (Kind=nag_wp), Intent (In) |
:: |
t |
|
C Header Interface
double |
psi_ (const double *t) |
|
C++ Header Interface
#include <nag.h> extern "C" {
double |
psi_ (const double &t) |
}
|
-
1:
– 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:
– real (Kind=nag_wp) Function, supplied by the user.
External Procedure
-
psp must return the value of
for a given value of its argument.
The specification of
psp is:
Fortran Interface
Real (Kind=nag_wp) |
:: |
psp |
Real (Kind=nag_wp), Intent (In) |
:: |
t |
|
C Header Interface
double |
psp_ (const double *t) |
|
C++ Header Interface
#include <nag.h> extern "C" {
double |
psp_ (const double &t) |
}
|
-
1:
– 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:
– Integer
Input
-
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.
-
4:
– Integer
Input
-
On entry: if
,
indc must specify the approximation to be used.
If , averaging over residuals.
If , replacing expected by observed.
If
,
indc is not referenced.
-
5:
– Real (Kind=nag_wp)
Input
-
On entry: the value of
, as given by
g02hdf.
Constraint:
.
-
6:
– Integer
Input
-
On entry: , the number of observations.
Constraint:
.
-
7:
– Integer
Input
-
On entry: , the number of independent variables.
Constraint:
.
-
8:
– Real (Kind=nag_wp) array
Input
-
On entry: the values of the matrix, i.e., the independent variables.
must contain the th element of , for and .
-
9:
– Integer
Input
-
On entry: the first dimension of the array
x as declared in the (sub)program from which
g02hff is called.
Constraint:
.
-
10:
– Real (Kind=nag_wp) array
Input
-
On entry: the residuals from the bounded influence regression. These are given by
g02hdf.
-
11:
– Real (Kind=nag_wp) array
Input
-
On entry: if
,
wgt must contain the vector of weights used by the bounded influence regression. These should be used with
g02hdf.
If
,
wgt is not referenced.
-
12:
– Real (Kind=nag_wp) array
Output
-
On exit: the estimate of the variance-covariance matrix.
-
13:
– Integer
Input
-
On entry: the first dimension of the array
c as declared in the (sub)program from which
g02hff is called.
Constraint:
.
-
14:
– Real (Kind=nag_wp) array
Output
-
On exit: if
,
, for
, will contain the diagonal elements of the matrix
and
, for
, will contain the diagonal elements of matrix
.
The rest of the array is used as workspace.
-
15:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended.
When the value or is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
-
On entry, .
Constraint: .
-
matrix is singular or almost singular.
matrix not positive definite.
-
Either the value of ,
or ,
or .
In this situation g02hff returns as .
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface 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.
g02hff 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
10.2
Program Data
10.3
Program Results