# naginterfaces.library.correg.robustm_​corr_​huber¶

naginterfaces.library.correg.robustm_corr_huber(x, eps, maxit=150, nitmon=0, tol=5e-05, io_manager=None)[source]

robustm_corr_huber computes a robust estimate of the covariance matrix for an expected fraction of gross errors.

For full information please refer to the NAG Library document for g02hk

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g02/g02hkf.html

Parameters
xfloat, array-like, shape

must contain the th observation for the th variable, for , for .

epsfloat

, the expected fraction of gross errors expected in the sample.

maxitint, optional

The maximum number of iterations that will be used during the calculation of the covariance matrix.

nitmonint, optional

Indicates the amount of information on the iteration that is printed.

The value of , and (see Accuracy) will be printed at the first and every iterations.

No iteration monitoring is printed.

When printing occurs the output is directed to the file object associated with the advisory I/O unit (see FileObjManager).

tolfloat, optional

The relative precision for the final estimates of the covariance matrix.

io_managerFileObjManager, optional

Manager for I/O in this routine.

Returns
covfloat, ndarray, shape

A robust estimate of the covariance matrix, . The upper triangular part of the matrix is stored packed by columns. is returned in , .

thetafloat, ndarray, shape

The robust estimate of the location parameters , for .

nitint

The number of iterations performed.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, a variable has a constant value, i.e., all elements in column of are identical.

(errno )

The iterative procedure to find has failed to converge in iterations.

(errno )

The iterative procedure to find has become unstable. This may happen if the value of is too large for the sample.

Notes

For a set of 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 xi is a vector of length m containing the elements of the ith row of x, zi is a vector of length m, I is the identity matrix and 0 is the zero matrix, and w and u are suitable functions.

robustm_corr_huber uses weight functions:

and

for constants , and .

These functions solve a minimax problem considered by Huber (see 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)).

The matrix is calculated using robustm_corr_user_deriv(). 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)). robustm_corr_huber is based on routines in ROBETH; see Marazzi (1987).

References

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