esaddle (version 0.0.6)

robCov: Robust covariance matrix estimation

Description

Obtains a robust estimate of the covariance matrix of a sample of multivariate data, using Campbell's (1980) method as described on p231-235 of Krzanowski (1988).

Usage

robCov(sY, alpha = 2, beta = 1.25)

Arguments

sY

A matrix, where each column is a replicate observation on a multivariate r.v.

alpha

tuning parameter, see details.

beta

tuning parameter, see details.

Value

A list where:

  • COV The estimated covariance matrix.

  • E A square root of the inverse covariance matrix. i.e. the inverse cov matrix is t(E)%*%E;

  • half.ldet.V Half the log of the determinant of the covariance matrix;

  • mY The estimated mean;

  • sd The estimated standard deviations of each variable.

  • weights This is w1/sum(w1)*ncol(sY), where w1 are the weights of Campbell (1980).

  • lowVar The indexes of the columns of sY whose variance is zero (if any). These variable were removed and excluded from the covariance matrix.

Details

Campbell (1980) suggests an estimator of the covariance matrix which downweights observations at more than some Mahalanobis distance d.0 from the mean. d.0 is sqrt(nrow(sY))+alpha/sqrt(2). Weights are one for observations with Mahalanobis distance, d, less than d.0. Otherwise weights are d.0*exp(-.5*(d-d.0)^2/beta^2)/d. The defaults are as recommended by Campbell. This routine also uses pre-conditioning to ensure good scaling and stable numerical calculations. If some of the columns of sY has zero variance, these are removed.

References

Krzanowski, W.J. (1988) Principles of Multivariate Analysis. Oxford. Campbell, N.A. (1980) Robust procedures in multivariate analysis I: robust covariance estimation. JRSSC 29, 231-237.

Examples

Run this code
# NOT RUN {
p <- 5;n <- 100
Y <- matrix(runif(p*n),p,n)
robCov(Y)
# }

Run the code above in your browser using DataCamp Workspace