covNNC()
estimates robust covariance/dispersion matrices by the
nearest neighbor variance estimation (NNVE) or (rather)
“Nearest Neighbor Cleaning” (NNC) method of Wang and Raftery
(2002, JASA).
covNNC(X, k = min(12, n - 1), pnoise = 0.05, emconv = 0.001,
bound = 1.5, extension = TRUE, devsm = 0.01)
matrix in which each row represents an observation or point and each column represents a variable.
desired number of nearest neighbors (default is 12)
percent of added noise
convergence tolerance for EM
value used to identify surges in variance caused by
outliers wrongly included as signal points (bound = 1.5
means a 50 percent increase)
whether or not to continue after reaching the last
chi-square distance. The default is to continue,
which is indicated by setting extension = TRUE
.
when extension = TRUE
, the algorithm stops if the
relative difference in variance is less than devsm
.
(default is 0.01)
A list with components
covariance matrix
mean vector
posterior probability
classification (0=noise otherwise 1) obtained
by rounding postprob
list of initial nearest neighbor cleaning results (components are the covariance, mean, posterior probability and classification)
Wang, N. and Raftery, A. (2002) Nearest neighbor variance estimation (NNVE): Robust covariance estimation via nearest neighbor cleaning (with discussion). Journal of the American Statistical Association 97, 994--1019.
see also University of Washington Statistics Technical Report 368 (2000) https://www.stat.washington.edu/research/reports
cov.mcd
from package MASS;
covMcd
, and covOGK
from package robustbase.
The whole package rrcov.
# NOT RUN {
data(iris)
covNNC(iris[-5])
data(hbk, package="robustbase")
hbk.x <- data.matrix(hbk[, 1:3])
covNNC(hbk.x)
# }
Run the code above in your browser using DataLab