# reclas: Recursive Robust Median-like Location and Scale In robustX: 'eXtra' / 'eXperimental' Functionality for Robust Statistics

## Description

Calculate an estimate of location, asymptotically equivalent to the median, and an estimate of scale equal to the MEAN absolute deviation. Both done recursively.

## Usage

 ```1 2 3``` ```reclas(y, b = 0.2, mfn = function(n) 0.1 * n^(-0.25), nstart = 30, m0 = median(y0), scon=NULL, updateScale = is.null(scon)) ```

## Arguments

 `y` numeric vector of i.i.d. data whose location and scale parameters are to be estimated. `b` numeric tuning parameter (default value equal to that used by Holst, 1987). `mfn` a `function` of the index of the data which must be positive and and tend to 0 as the index tends to infinity. The default function is that used by Holst, 1987. `nstart` number of starting values: Starting values for the algorithm are formed from the first `nstart` values of `y`. The default value is that used in Cameron and Turner, 1993. `m0` value for the initial approximate median; by default, the `median` of the first `nstart` observations. `scon` value for the scale parameter `s`, a `function` or `NULL`. When `NULL`, as by default, the scale is initialized to the mean of the absolute differences between the first `nstart` y values and `m0`. If scon is a function, the initial scale is set to `scon(y0, m0)`, where `y0` is the vector of the first `nstart` y values. Note that `scon` also determines the default for `updateScale`. `updateScale` a logical indicating if the scale, initialized from `scon` should be updated in each iteration. Otherwise, the the scale is held constant throughout and the algorithm becomes equivalent to the algorithm of Holst.

## Value

An S3 “object” of `class` `"reclas"`; simply a list with entries

 `locn` the successive recursive estimates of location. The first `nstart - 1` of these are `NA`. `scale` the successive recursive estimates of scale if `updateScale` is true; otherwise the constant value used for the scale. `updateScale` the same as the function argument. `call` the function call, i.e., `match.call`.

There is a `plot` method for `"reclas"`, see the examples.

## Author(s)

Extensions by Martin Maechler (`scon` as function; `updateScale`, `plot()`).

## References

Cameron, Murray A. and Turner, T. Rolf (1993). Recursive location and scale estimators. Commun. Statist. — Theory Meth. 22(9) 2503–2515.

Holst, U. (1987). Recursive estimators of location. Commun. Statist. — Theory Meth. 16 (8) 2201–2226.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```set.seed(42) y <- rt(10000, df = 1.5) # not quite Gaussian ... z1 <- reclas(y) z3 <- reclas(y, scon= 1 ) # correct fixed scale z4 <- reclas(y, scon= 100) # wrong fixed scale z2 <- reclas(y, # a more robust initial scale: scon = function(y0, m0) robustbase::Qn(y0 - m0), updateScale = TRUE) # still updated ## Visualizing -- using the plot() method for "reclas": M <- median(y) ; yl <- c(-1,1)* 0.5 OP <- par(mfrow=c(2,2), mar=.1+c(3,3,1,1), mgp=c(1.5, .6, 0)) plot(z1, M=M, ylim=yl) plot(z2, M=M, ylim=yl) plot(z3, M=M, ylim=yl) plot(z4, M=M, ylim=yl) par(OP) ```

robustX documentation built on May 2, 2019, 5:16 p.m.