The function may be called by the names: g02hkc, nag_correg_robustm_corr_huber or nag_robust_corr_estim.
3Description
For a set observations on variables in a matrix , a robust estimate of the covariance matrix, , and a robust estimate of location, , are given by:
where is a correction factor and is a lower triangular matrix found as the solution to the following equations.
and
where
is a vector of length containing the elements of the th row of X,
is a vector of length ,
is the identity matrix and 0 is the zero matrix,
and
and are suitable functions.
g02hkc uses weight functions:
and
for constants , and .
These functions solve a minimax problem considered by Huber (1981).
The values of , and are calculated from the expected fraction of gross errors, (see Huber (1981) and Marazzi (1987)). The expected fraction of gross errors is the estimated proportion of outliers in the sample.
In order to make the estimate asymptotically unbiased under a Normal model a correction factor, , is calculated, (see Huber (1981) and Marazzi (1987)).
Initial estimates of , for , are given by the median of the th column of and the initial value of is based on the median absolute deviation (see Marazzi (1987)). g02hkc is based on routines in ROBETH, (see Marazzi (1987)).
4References
Huber P J (1981) Robust Statistics Wiley
Marazzi A (1987) Weights for bounded influence regression in ROBETH Cah. Rech. Doc. IUMSP, No. 3 ROB 3 Institut Universitaire de Médecine Sociale et Préventive, Lausanne
5Arguments
1: – IntegerInput
On entry: the number of observations, .
Constraint:
.
2: – IntegerInput
On entry: the number of columns of the matrix , i.e., number of independent variables, .
Constraint:
.
3: – const doubleInput
On entry: must contain the th observation for the th variable, for and .
4: – IntegerInput
On entry: the stride separating matrix column elements in the array x.
Constraint:
.
5: – doubleInput
On entry: the expected fraction of gross errors expected in the sample, .
Constraint:
.
6: – doubleOutput
On exit: the /2 elements of cov contain the upper triangular part of the covariance matrix. They are stored packed by column, i.e., , , is stored in , for and .
7: – doubleOutput
On exit: the robust estimate of the location arguments , for .
8: – IntegerInput
On entry: the maximum number of iterations that will be used during the calculation of the covariance matrix.
Suggested value:
.
Constraint:
.
9: – IntegerInput
On entry: indicates if the printing of information on the iterations is required and the rate at which printing is produced.
No iteration monitoring is printed.
The value of , and (see Section 9) will be printed at the first and every print_iter iterations.
10: – const char *Input
On entry: a null terminated character string giving the name of the file to which results should be printed. If outfile is NULL or an empty string then the stdout stream is used. Note that the file will be opened in the append mode.
11: – doubleInput
On entry: the relative precision for the final estimates of the covariance matrix.
Constraint:
.
12: – Integer *Output
On exit: the number of iterations performed.
13: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
NE_2_INT_ARG_GT
On entry, while . These arguments must satisfy .
NE_2_INT_ARG_LT
On entry, while . These arguments must satisfy .
NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_C_ITER_UNSTABLE
The iterative procedure to find has become unstable. This may happen if the value of eps is too large.
Too many iterations( ).
The iterative procedure to find the co-variance matrix , has failed to converge in max_iter iterations.
7Accuracy
On successful exit the accuracy of the results is related to the value of tol, see Section 5. At an iteration let
(i) the maximum value of the absolute relative change in
(ii) the maximum absolute change in
(iii) the maximum absolute relative change in
and let . Then the iterative procedure is assumed to have converged when .
8Parallelism and Performance
g02hkc 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
The existence of , and hence , will depend upon the function , (see Marazzi (1987)), also if is not of full rank a value of will not be found. If the columns of are almost linearly related, then convergence will be slow.
10Example
A sample of 10 observations on three variables is read in and the robust estimate of the covariance matrix is computed assuming 10% gross errors are to be expected. The robust covariance is then printed.