reclas | R Documentation |
Calculate an estimate of location, asymptotically equivalent to the median, and an estimate of scale equal to the MEAN absolute deviation. Both done recursively.
reclas(y, b = 0.2, mfn = function(n) 0.1 * n^(-0.25),
nstart = 30, m0 = median(y0),
scon=NULL, updateScale = is.null(scon))
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 |
nstart |
number of starting values: Starting values for the
algorithm are formed from the first |
m0 |
value for the initial approximate median; by default, the
|
scon |
value for the scale parameter |
updateScale |
a logical indicating if the scale, initialized
from |
An S3 “object” of class
"reclas"
; simply a
list with entries
locn |
the successive recursive estimates of location. The
first |
scale |
the successive recursive estimates of scale if
|
updateScale |
the same as the function argument. |
call |
the function call, i.e., |
There is a plot
method for "reclas"
, see the
examples.
r.turner@auckland.ac.nz http://www.stat.auckland.ac.nz/~rolf
Extensions by Martin Maechler (scon
as function;
updateScale
, plot()
).
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.