location.m(x, location = <<see below>>, scale = <<see below>>, weights = <<see below>>, na.rm = F, psi.fun = "bisquare", parameters = <<see below>>, sum.tol = 1e-08, est.tol = 1e-08, max.evals = 10)
location
.
x
giving the observation weights.
The default is that all weights are equal.
TRUE
, then missing values are removed before the
computations.
"bisquare"
,
"huber"
or the symbol for a psi function that has
been loaded into S-PLUS.
5
if
psi.fun
is
"bisquare"
, and
1.45
if
psi.fun
is
"huber"
.
scale
) for the width of the interval
within which the solution is known to exist.
If the interval is shorter than this, convergence is assumed.
An M-estimate of location is a solution
mu
of the equation:
sum(psi( (y-mu)/s )) = 0
.
This function fixes the scale
s
throughout the computation.
The scale can be estimated simultaneously, but doing that has a lower
breakdown point.
The estimates from
location.m
have the same breakdown
point as the scale estimate, which is 50% using the default scale.
A bisquare psi function of
x
equals
x * (c^2 - x^2)^2
when abs(x) < c,
and equals
0
otherwise.
A Huber psi function of
x
is equal to
x
when
abs(x)
is less than
the tuning constant
c
and is equal to
c
times the sign of
x
otherwise.
Thus, the Huber psi down-weights outliers and the bisquare entirely ignores
data that are extreme outliers.
Least squares corresponds to a psi of
x
equal to
x
.
You have the ability to specify a psi function of your own by writing a
C or Fortran function and loading the code into S-PLUS.
The function should take two arguments: the first is a double precision
number that corresponds to an observation, the second is a double precision
vector of parameters.
If it is C code, the arguments are to be pointers and the result is returned.
If it is Fortran, it should be a function (rather than a subroutine).
Hampel, F. R., Ronchetti, E. M., Rousseeuw, P. J. and Stahel, W. A. (1986).
Robust Statistics: The Approach Based on Influence Functions.
Wiley, New York.
Hoaglin, D. C., Mosteller, F. and Tukey, J. W., editors (1983).
Understanding Robust and Exploratory Data Analysis.
Wiley, New York.
Staudte, R. G. and Sheather, S. J. (1990).
Robust Estimation and Testing.
Wiley, New York.
This function deprecates
robloc
.
location.m(car.miles) location.m(car.miles, psi="huber", parameter=2) # user supplied psi function (must be compiled and dynamically # loaded into S-PLUS) !cat hampel.c double hampel(u,abc) double *u, abc[]; { double au, signu; au = *u >= 0 ? *u : - *u; signu = *u >= 0 ? 1 : -1; if(au <= abc[0]) return(*u); else if(au <= abc[1]) return( abc[0] * signu); else if(au <= abc[2]) return( abc[0] * (abc[2] - au)/(abc[2] -abc[1]) * signu); else return(0.); } location.m(car.miles, psi=symbol.C("hampel"), parameters=c(1.3,2,4))