covOGK(X, n.iter = 2, sigmamu, rcov = covGK, weight.fn = hard.rejection,
keep.data = FALSE, ...)covGK (x, y, scalefn = scaleTau2, ...)
s_mad(x, mu.too = FALSE, na.rm = FALSE)
s_IQR(x, mu.too = FALSE, na.rm = FALSE)
mu.too
is true, sigmamu()
scovGK
, is simply $(s^2(X+Y) - s^2(X-Y))/4$ where
$s()$ is the scale estimate sigmamu()
.X
should be kept as part of the result.covOGK
to be passed to
sigmamu()
and weight.fn()
; for covGK
passed to scalefn
.covGK
(or the scale, in s_mad
or
s_IQR
).mu.too=FALSE
as by default).TRUE
then NA
values are stripped
from x
before computation takes place.covOGK()
currently returns a list with componentscenter
and
cov
.center
and cov
. covGK()
is a trivial 1-line function returning the covariance
estimate
scalefn
.
s_mad()
, and s_IQR()
return the
scale estimates mad
or IQR
respectively, where the s_*
functions return a length-2 vector
(mu, sig) when mu.too = TRUE
, see also scaleTau2
.
sigmamu
, rcov
, and weight.fn
, are
available as well, see the Examples below,
but their names and calling sequences are
still subject to discussion and may be changed in the future. The current default, weight.fn = hard.rejection
corresponds to
the proposition in the litterature, but Martin Maechler strongly
believes that the hard threshold currently in use is too arbitrary,
and further that soft thresholding should be used instead, anyway.
Gnanadesikan, R. and John R. Kettenring (1972) Robust estimates, residuals, and outlier detection with multiresponse data. Biometrics 28, 81--124.
scaleTau2
,
covMcd
, cov.rob
.data(hbk)
hbk.x <- data.matrix(hbk[, 1:3])
cO1 <- covOGK(hbk.x, sigmamu = scaleTau2)
cO2 <- covOGK(hbk.x, sigmamu = s_Qn)
cO3 <- covOGK(hbk.x, sigmamu = s_Sn)
cO4 <- covOGK(hbk.x, sigmamu = s_mad)
cO5 <- covOGK(hbk.x, sigmamu = s_IQR)
data(toxicity)
cO1tox <- covOGK(toxicity, sigmamu = scaleTau2)
cO2tox <- covOGK(toxicity, sigmamu = s_Qn)
## nice formatting of correlation matrices:
as.dist(round(cov2cor(cO1tox$cov), 2))
as.dist(round(cov2cor(cO2tox$cov), 2))
## "graphical"
symnum(cov2cor(cO1tox$cov))
symnum(cov2cor(cO2tox$cov), legend=FALSE)
Run the code above in your browser using DataLab