LADFIT
Syntax | Return Value | Arguments | Keywords | Example | Version History | See Also
The LADFIT function fits the paired data {xi, yi} to the linear model, y = A + Bx, using a "robust" least absolute deviation method.
The figure below displays a two-dimensional distribution that is fitted to the model y = A + Bx, using a minimized Chi-square error criterion (left) and a "robust" least absolute deviation technique (right). The use of the Chi-square error statistic can result in a poor fit due to an undesired sensitivity to outlying data.
This routine is written in the IDL language. Its source code can be found in the file ladfit.pro in the lib subdirectory of the IDL distribution.
Syntax
Result = LADFIT( X, Y [, ABSDEV=variable] [, /DOUBLE] )
Return Value
The result is a two-element vector containing the model parameters, A and B.
Arguments
X
An n-element vector containing the independent variable values. X may be of type integer, floating point, or double-precision floating-point. Note that the X vector must be sorted into ascending order.
Y
An n-element integer, single-, or double-precision floating-point vector. Note that the elements of the Y vector must be paired with the appropriate elements of X.
Keywords
ABSDEV
Set this keyword to a named variable that will contain the mean of the absolute deviation of the Result and Y.
DOUBLE
Set this keyword to force the computation to be done in double-precision arithmetic.
Example
IDL prints:
Version History
See Also
COMFIT, CURVEFIT, LINFIT, SORT, Curve and Surface Fitting (Using IDL)
