Description Usage Arguments Details Value Author(s) References Examples
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).
1 |
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. |
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.
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.
Simon N. Wood, maintained by Matteo Fasiolo <matteo.fasiolo@gmail.com>.
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.
1 2 3 |
$E
[,1] [,2] [,3] [,4] [,5]
[1,] 3.4776006 0.000000000 0.00000000 0.0000000 0.000000
[2,] -0.1453823 3.405978145 0.00000000 0.0000000 0.000000
[3,] -1.0062554 -0.167596725 3.62440170 0.0000000 0.000000
[4,] -0.2057850 -0.009737241 0.09486626 -3.5493408 0.000000
[5,] 0.2537781 -0.044720662 0.40068249 -0.6237927 3.382364
$half.ldet.V
[1] -6.244901
$mY
[1] 0.5355426 0.4925401 0.5350717 0.5002884 0.5105859
$sd
[1] 0.2875546 0.2938579 0.2877045 0.2822150 0.3036873
$COV
[,1] [,2] [,3] [,4] [,5]
[1,] 0.082687638 0.003529477 0.0231200680 -0.0041858267 -0.009668197
[2,] 0.003529477 0.086352444 0.0049729429 -0.0003086160 0.000230889
[3,] 0.023120068 0.004972943 0.0827738685 0.0008582614 -0.011316237
[4,] -0.004185827 -0.000308616 0.0008582614 0.0796452842 0.014896896
[5,] -0.009668197 0.000230889 -0.0113162368 0.0148968958 0.092225981
$weights
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
$lowVar
integer(0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.