stats[fit, leastmediansquare]  Fit a Curve to data using the least median of squares method

Calling Sequence


stats[fit, leastmediansquare[vars]](data)
fit[leastmediansquare[vars]](data)


Parameters


data



list of statistical lists

vars



list of variables, corresponding, in order, to the lists in data





Description


•

The function leastmediansquare of the subpackage stats[fit, ...] fits a curve to the given data using the method of least median of squares.

•

The equation to fit will be linear (affine) in the unknown parameters. The equation itself need not be linear. For example, specifying vars to be implies fitting to the equation .

•

The wellknown least square regression method suffer from leverage points. By adding a single point to the data, one can change the result to an arbitrary extent. The least median of squares method allows one to add up to half the number of points without changing the result. The price to pay for this robustness is a substantial increase in computation cost.

•

Missing data and ranges cannot be handled.

•

Weighted data are handled in the following fashion. The weight associated with the dependent variable is the weight given to the corresponding point. The weight specifications corresponding to the independent variables are ignored.

•

The command with(stats[fit],leastmediansquare) allows the use of the abbreviated form of this command.



Examples


Important: The stats package has been deprecated. Use the superseding package Statistics instead.
>


>


>


 (1) 
This is calculated as follows. For example, pick two points, say [1,3] and [2,4]. Pass a straight line through them. In this case it is y=2+x. For each point compute the square of the distance of the line to the point This gives [0,0,0,sqrt(2)/2]. Find the median through these distances: this gives 0. Now minimize over all possible lines. This is the result.
Here's an example using Weight
>


>


 (2) 


References



Rousseeuw, P. J. "Least Median of Squares Regression." Journal of the American Statistical Association, (December 1984): 871880.



Download Help Document
Was this information helpful?