scaleM: M-scale estimator

View source: R/DCML.R

scaleMR Documentation

M-scale estimator

Description

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.

Usage

scaleM(
  u,
  delta = 0.5,
  family = "bisquare",
  max.it = 100,
  tol = 1e-06,
  tolerancezero = .Machine$double.eps
)

Arguments

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 .Machine$double.eps

Details

The iterative algorithm starts from the scaled median of the absolute values of the input vector, and then cycles through the equation s^2 = s^2 * mean(rho(r/s, cc)) / delta.

Value

The scale estimate value at the last iteration or at convergence.

Author(s)

Matias Salibian-Barrera, matias@stat.ubc.ca

Examples

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)


msalibian/RobStatTM documentation built on April 24, 2024, 5:10 a.m.