fit(deprecated)/leastmed - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : fit(deprecated)/leastmed

stats[fit, leastmediansquare]

Fit a Curve to data using the least median of squares method

 

Calling Sequence

Parameters

Description

Examples

References

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

• 

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

• 

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 x,y implies fitting to the equation y=ax2+bx+c.

• 

The well-known 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.

withstats:

dataconvertlinalgtranspose1,3,2,4,3,5,1,2,listlist:

fitleastmediansquarex,ydata

y=x+2

(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

dataconvertlinalgtranspose1,3,2,4,3,5,1,Weight2,4,listlist:

fitleastmediansquarex,ydata

x=1

(2)

References

  

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

See Also

describe(deprecated)[linearcorrelation]

Statistics