PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_correg_robustm_user_varmat (g02hf)
Purpose
nag_correg_robustm_user_varmat (g02hf) calculates an estimate of the asymptotic variance-covariance matrix for the bounded influence regression estimates (M-estimates). It is intended for use with
nag_correg_robustm_user (g02hd).
Syntax
[
c,
wk,
ifail] = g02hf(
psi,
psp,
indw,
indc,
sigma,
x,
rs,
wgt, 'n',
n, 'm',
m)
[
c,
wk,
ifail] = nag_correg_robustm_user_varmat(
psi,
psp,
indw,
indc,
sigma,
x,
rs,
wgt, 'n',
n, 'm',
m)
Description
For a description of bounded influence regression see
nag_correg_robustm_user (g02hd). 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_correg_robustm_user_varmat (g02hf):
1. |
Average over the
|
2. |
Replace expected value by observed
|
In all cases is a robust estimate of .
nag_correg_robustm_user_varmat (g02hf) 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) 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
Parameters
Compulsory Input Parameters
- 1:
– function handle or string containing name of m-file
-
psi must return the value of the
function for a given value of its argument.
[result] = psi(t)
Input Parameters
- 1:
– double scalar
-
The argument for which
psi must be evaluated.
Output Parameters
- 1:
– double scalar
-
The value of the function
evaluated at
t.
- 2:
– function handle or string containing name of m-file
-
psp must return the value of
for a given value of its argument.
[result] = psp(t)
Input Parameters
- 1:
– double scalar
-
The argument for which
psp must be evaluated.
Output Parameters
- 1:
– double scalar
-
The value of
evaluated at
t.
- 3:
– int64int32nag_int scalar
-
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:
– int64int32nag_int scalar
-
If
,
indc must specify the approximation to be used.
If , averaging over residuals.
If , replacing expected by observed.
If
,
indc is not referenced.
- 5:
– double scalar
-
Constraint:
.
- 6:
– double array
-
ldx, the first dimension of the array, must satisfy the constraint
.
The values of the matrix, i.e., the independent variables.
must contain the th element of , for and .
- 7:
– double array
-
The residuals from the bounded influence regression. These are given by
nag_correg_robustm_user (g02hd).
- 8:
– double array
-
If
,
wgt must contain the vector of weights used by the bounded influence regression. These should be used with
nag_correg_robustm_user (g02hd).
If
,
wgt is not referenced.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
rs,
wgt and the first dimension of the array
x. (An error is raised if these dimensions are not equal.)
, the number of observations.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the second dimension of the array
x.
, the number of independent variables.
Constraint:
.
Output Parameters
- 1:
– double array
-
The estimate of the variance-covariance matrix.
- 2:
– double array
-
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.
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
On entry, | , |
or | , |
or | , |
or | , |
or | . |
-
-
-
-
If then the matrix is either not positive definite, possibly due to rounding errors, or is ill-conditioned.
If then the matrix is singular or almost singular. This may be due to many elements of being zero.
-
-
Either the value of ,
or ,
or .
In this situation nag_correg_robustm_user_varmat (g02hf) returns as .
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
In general, the accuracy of the variance-covariance matrix will depend primarily on the accuracy of the results from
nag_correg_robustm_user (g02hd).
Further Comments
nag_correg_robustm_user_varmat (g02hf) 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 .
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.
Open in the MATLAB editor:
g02hf_example
function g02hf_example
fprintf('g02hf example results\n\n');
x = [1, -1, -1;
1, -1, 1;
1, 1, -1;
1, 1, 1;
1, 0, 3];
rs = [0.5643; -1.1286; 0.5643; -1.1286; 1.1286];
wgt = [0.4039; 0.5012; 0.4039; 0.5012; 0.3862];
indw = int64(1);
indc = int64(1);
sigma = 20.7783;
[c, wk, ifail] = g02hf( ...
@psi, @psp, indw, indc, sigma, x, rs, wgt);
disp('Covariance matrix');
disp(c);
function [result] = psi(t)
if t < -1.5
result = -1.5;
elseif abs(t) < 1.5
result = t;
else
result = 1.5;
end;
function [result] = psp(t)
if (abs(t) < 1.5)
result=1;
else
result=0;
end
g02hf example results
Covariance matrix
0.2070 0 -0.0478
0 0.2229 0
-0.0478 0 0.0796
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015