scaleM | R Documentation |
This function computes an M-scale, which is a robust
scale (spread) estimator.
M-estimators of scale are a robust alternative to
the sample standard deviation. Given a vector of
residuals r
, the M-scale estimator s
solves the non-linear equation mean(rho(r/s, cc))=delta
,
where delta
determines the breakdown point of the
estimator, and cc
is a tuning parameter
calculated to obtain consistency under a Gaussian model.
The breakdown point of the estimator is min(delta, 1-delta)
,
so the optimal choice for delta
is 0.5. To obtain a
consistent estimator the constant
cc
is chosen such that E(rho(Z, cc)) = delta, where
Z is a standard normal random variable.
scaleM(
u,
delta = 0.5,
family = "bisquare",
max.it = 100,
tol = 1e-06,
tolerancezero = .Machine$double.eps,
tuning.chi = lmrobdet.control(family = family, bb = delta)$tuning.chi
)
u |
vector of residuals |
delta |
the right hand side of the M-scale equation |
family |
string specifying the name of the family of loss function to be used (current valid options are "bisquare", "opt" and "mopt"). |
max.it |
maximum number of iterations allowed |
tol |
relative tolerance for convergence |
tolerancezero |
smallest (in absolute value) non-zero value accepted as a scale. Defaults to |
tuning.chi |
the tuning object as returned
by |
The iterative algorithm starts from the scaled median of
the absolute values of the input vector, and then
cycles through the equation s_{k+1}^2 = s_k^2 * mean(rho(r/s_k, cc)) / delta
.
The scale estimate value at the last iteration or at convergence.
Matias Salibian-Barrera, matias@stat.ubc.ca
set.seed(123)
r <- rnorm(150, sd=1.5)
scaleM(r)
sd(r)
# 10% of outliers, sd of good points is 1.5
set.seed(123)
r2 <- c(rnorm(135, sd=1.5), rnorm(15, mean=-5, sd=.5))
scaleM(r2, family='opt')
sd(r2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.