R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("covRobust-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('covRobust') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "cov.nnve" > > ### * cov.nnve > > flush(stderr()); flush(stdout()) > > ### Name: cov.nnve > ### Title: Robust Covariance Estimation via Nearest Neighbor Cleaning > ### Aliases: cov.nnve > ### Keywords: multivariate robust > > ### ** Examples > > data(iris) > cov.nnve(iris[-5]) $cov [,1] [,2] [,3] [,4] [1,] 0.58766332 -0.07398017 1.1541669 0.4825507 [2,] -0.07398017 0.13837244 -0.3417718 -0.1296508 [3,] 1.15416691 -0.34177177 2.9542649 1.2567524 [4,] 0.48255066 -0.12965076 1.2567524 0.5754763 $mu Sepal.Length Sepal.Width Petal.Length Petal.Width 5.795426 3.071265 3.680866 1.176461 $postprob [1] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [6] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [11] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 9.982665e-01 [16] 5.660588e-158 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [21] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [26] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [31] 1.000000e+00 1.000000e+00 9.999986e-01 1.063175e-24 1.000000e+00 [36] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [41] 1.000000e+00 3.163497e-136 1.000000e+00 1.000000e+00 1.000000e+00 [46] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [51] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [56] 1.000000e+00 1.000000e+00 9.999852e-01 1.000000e+00 1.000000e+00 [61] 4.951128e-74 1.000000e+00 4.039360e-05 1.000000e+00 1.000000e+00 [66] 1.000000e+00 1.000000e+00 1.000000e+00 1.039353e-04 1.000000e+00 [71] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [76] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [81] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [86] 9.998382e-01 1.000000e+00 9.999911e-01 1.000000e+00 1.000000e+00 [91] 1.000000e+00 1.000000e+00 1.000000e+00 5.615524e-04 1.000000e+00 [96] 1.000000e+00 1.000000e+00 1.000000e+00 9.999995e-01 1.000000e+00 [101] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [106] 9.976415e-01 3.168355e-01 9.999997e-01 9.988788e-01 4.922098e-37 [111] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [116] 1.000000e+00 1.000000e+00 3.122314e-234 8.376891e-121 4.733103e-07 [121] 1.000000e+00 1.000000e+00 7.047000e-49 1.000000e+00 1.000000e+00 [126] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [131] 3.573661e-01 4.213386e-292 1.000000e+00 1.000000e+00 1.000000e+00 [136] 9.991833e-01 9.999999e-01 1.000000e+00 1.000000e+00 1.000000e+00 [141] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [146] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 $classification [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 [38] 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 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 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 [112] 1 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [149] 1 1 $innc $innc$cov Sepal.Length Sepal.Width Petal.Length Petal.Width Sepal.Length 0.53013518 -0.08128338 1.0968311 0.4751778 Sepal.Width -0.08128338 0.10970763 -0.3225952 -0.1229924 Petal.Length 1.09683108 -0.32259520 2.8234407 1.2164172 Petal.Width 0.47517780 -0.12299238 1.2164172 0.5593988 $innc$mu Sepal.Length Sepal.Width Petal.Length Petal.Width 5.723749 3.062876 3.560977 1.127211 $innc$postprob [1] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [6] 1.711343e-01 1.000000e+00 1.000000e+00 9.999997e-01 1.000000e+00 [11] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 2.309910e-19 [16] 7.747016e-268 7.177075e-01 1.000000e+00 1.963346e-03 1.000000e+00 [21] 1.000000e+00 1.000000e+00 9.999999e-01 1.000000e+00 1.000000e+00 [26] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [31] 1.000000e+00 1.000000e+00 1.441755e-14 7.063285e-61 1.000000e+00 [36] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [41] 1.000000e+00 0.000000e+00 1.000000e+00 1.000000e+00 9.999874e-01 [46] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [51] 5.812702e-02 1.000000e+00 1.000000e+00 7.726717e-01 1.000000e+00 [56] 1.000000e+00 9.994284e-01 3.762373e-16 1.000000e+00 9.999999e-01 [61] 1.745179e-137 1.000000e+00 1.795669e-30 1.000000e+00 1.000000e+00 [66] 9.999987e-01 1.000000e+00 1.000000e+00 7.792111e-30 1.000000e+00 [71] 9.999874e-01 1.000000e+00 9.999570e-01 1.000000e+00 1.000000e+00 [76] 1.000000e+00 9.999996e-01 1.000000e+00 1.000000e+00 9.999999e-01 [81] 9.999664e-01 9.989320e-01 1.000000e+00 1.000000e+00 1.000000e+00 [86] 9.202298e-18 1.000000e+00 8.346147e-16 1.000000e+00 9.999999e-01 [91] 1.000000e+00 1.000000e+00 1.000000e+00 1.070669e-28 1.000000e+00 [96] 1.000000e+00 1.000000e+00 1.000000e+00 7.200729e-14 1.000000e+00 [101] 8.234718e-08 9.999999e-01 1.000000e+00 1.000000e+00 1.000000e+00 [106] 1.430659e-19 3.621917e-24 1.406446e-13 4.549045e-19 4.953561e-80 [111] 1.000000e+00 1.000000e+00 1.000000e+00 1.189762e-05 8.985381e-01 [116] 1.000000e+00 1.000000e+00 0.000000e+00 4.078622e-210 1.800131e-33 [121] 1.000000e+00 9.999987e-01 2.005512e-98 1.000000e+00 1.000000e+00 [126] 2.294380e-01 1.000000e+00 1.000000e+00 9.999998e-01 7.022288e-01 [131] 4.801429e-24 0.000000e+00 9.999874e-01 1.000000e+00 8.176383e-01 [136] 7.444583e-19 1.195883e-12 1.000000e+00 1.000000e+00 1.000000e+00 [141] 1.000000e+00 1.000000e+00 9.999999e-01 1.000000e+00 9.998421e-01 [146] 1.000000e+00 9.914360e-01 1.000000e+00 2.058725e-04 1.000000e+00 $innc$classification [1] 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 [38] 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 [75] 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 [112] 1 1 0 1 1 1 0 0 0 1 1 0 1 1 0 1 1 1 1 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 [149] 0 1 > > > > ### *