Robust M-estimates of Location

DESCRIPTION:

Returns a number giving an estimate of the center of the data.

USAGE:

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) 

REQUIRED ARGUMENTS:

x
numeric vector of data. Missing values (NA) are allowed.

OPTIONAL ARGUMENTS:

location
initial estimate of location. The default value is the low median.
scale
estimate of scale. The default is the Gaussian consistent MAD from location.
weights
vector the same length as x giving the observation weights. The default is that all weights are equal.
na.rm
logical flag: if TRUE, then missing values are removed before the computations.
psi.fun
a character string. Either "bisquare", "huber" or the symbol for a psi function that has been loaded into S-PLUS.
parameters
numeric vector of parameters for the psi function. The default is 5 if psi.fun is "bisquare", and 1.45 if psi.fun is "huber".
sum.tol
number below which the sum of psi of the data is considered to be zero.
est.tol
tolerance (after scaling by 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.
max.evals
the maximum number of evaluations of the sum of psi of the data.

VALUE:

a number, giving the estimate of the center of the data. The number has two attributes:
convergence
a numeric vector giving information on the convergence criteria.
call
the call made to the function.

DETAILS:

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).

REFERENCES:

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.

NOTE:

This function deprecates robloc.

SEE ALSO:

, , , , .

EXAMPLES:

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))