| smult | R Documentation |
Computes S estimators in multivariate analysis
smult(
x,
monitoring = FALSE,
plot = FALSE,
bdp,
nsamp,
conflev = 0.975,
nocheck = FALSE,
trace = FALSE,
...
)
x |
An n x p data matrix (n observations and p variables). Rows of x represent observations, and columns represent variables. Missing values (NA's) and infinite values (Inf's) are allowed, since observations (rows) with missing or infinite values will automatically be excluded from the computations. |
monitoring |
Wheather to perform monitoring of Mahalanobis distances and other specific quantities |
plot |
Plots the Mahalanobis distances against index number. If
|
bdp |
Measures the fraction of outliers the algorithm should resist.
In this case any value greater than 0 but smaller or equal than 0.5 will do fine (default is |
nsamp |
Number of subsamples which will be extracted to find the robust estimator.
If |
conflev |
Confidence level which is used to declare units as outliers (scalar).
Usually |
nocheck |
It controls whether to perform checks on matrix Y. If |
trace |
Whether to print intermediate results. Default is |
... |
potential further arguments passed to lower level functions. |
This function follows the lines of MATLAB/R code developed during the years by many authors. For more details see http://www.econ.kuleuven.be/public/NDBAE06/programs/ and the R package CovSest The core of these routines, e.g. the resampling approach, however, has been completely redesigned, with considerable increase of the computational performance.
Depending on the input parameter monitoring, one of
the following objects will be returned:
smult.object
smulteda.object
FSDA team, valentin.todorov@chello.at
Maronna, R.A., Martin D. and Yohai V.J. (2006), Robust Statistics, Theory and Methods, Wiley, New York.
## Not run:
data(hbk, package="robustbase")
(out <- smult(hbk[,1:3]))
class(out)
summary(out)
## Generate contaminated data (200,3)
n <- 200
p <- 3
set.seed(123456)
X <- matrix(rnorm(n*p), nrow=n)
Xcont <- X
Xcont[1:5, ] <- Xcont[1:5,] + 3
out1 <- smult(Xcont, trace=TRUE) # no plots (plot defaults to FALSE)
names(out1)
## plot=TRUE - generates: (1) a plot of Mahalanobis distances against
## index number. The confidence level used to draw the confidence bands for
## the MD is given by the input option conflev. If conflev is
## not specified a nominal 0.975 confidence interval will be used and
## (2) a scatter plot matrix with the outliers highlighted.
(out1 <- smult(Xcont, trace=TRUE, plot=TRUE))
## plots is a list: the spm shows the labels of the outliers.
(out1 <- smult(Xcont, trace=TRUE, plot=list(labeladd="1")))
## plots is a list: the spm uses the variable names provided by 'nameY'.
(out1 <- smult(Xcont, trace=TRUE, plot=list(nameY=c("A", "B", "C"))))
## smult() with monitoring
(out2 <- smult(Xcont, monitoring=TRUE, trace=TRUE))
names(out2)
## Forgery Swiss banknotes examples.
data(swissbanknotes)
(out1 <- smult(swissbanknotes[101:200,], plot=TRUE))
(out1 <- smult(swissbanknotes[101:200,], plot=list(labeladd="1")))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.