Learn R Programming

pense (version 1.2.1)

mscale: Robust M-estimate of Scale

Description

Compute the M-estimate of scale with MAD as initial estimate.

Usage

mscale(x, delta = 0.5, rho = c("bisquare", "huber"), cc, eps = 1e-08,
  maxit = 200)

Arguments

x

numeric vector of observations.

delta

target value of the M-estimation equation.

rho

rho function to use in the M-estimation equation.

cc

non-negative constant for the chosen rho function. If missing, it will be chosen such that the expected value of the rho function under the normal model is equal to delta.

eps

threshold for convergence.

maxit

maximum number of iterations.

Value

the M-scale as a numeric vector of length one.

Details

This solves the M-estimation equation given by $$\sum_{i=1}^n \rho( x_i / s_n; cc ) = n \delta$$

Examples

Run this code
# NOT RUN {
## Estimate the M-scale of a vector of values
set.seed(1234)
x <- rnorm(100)
mscale(x)
mscale(x, delta = 0.25) # For a breakdown point of 25%
mscale(x, rho = "huber") # Using Huber's rho function
# }

Run the code above in your browser using DataLab