![]() |
Institut für Astronomie und AstrophysikAbteilung AstronomieWaldhäuser Str. 64, D-72076 Tübingen, Germany |
![]() |
FITEXY
Best straight-line fit to data with errors in both coordinates
Linear Least-squares approximation in one-dimension (y = a + b*x),
when both x and y data have errors
FITEXY, x, y, A, B, X_SIG= , Y_SIG= , [sigma_A_B, chi_sq, q, TOL=]
x = array of values for independent variable.
y = array of data values assumed to be linearly dependent on x.
X_SIGMA = scalar or array specifying the standard deviation of x data.
Y_SIGMA = scalar or array specifying the standard deviation of y data.
TOLERANCE = desired accuracy of minimum & zero location, default=1.e-3.
A_intercept = constant parameter result of linear fit,
B_slope = slope parameter, so that:
( A_intercept + B_slope * x ) approximates the y data.
sigma_A_B = two element array giving standard deviation of
A_intercept and B_slope parameters, respectively.
The standard deviations are not meaningful if (i) the
fit is poor (see parameter q), or (ii) b is so large that
the data are consistent with a vertical (infinite b) line.
If the data are consistent with *all* values of b, then
sigma_A_B = [1e33,e33]
chi_sq = resulting minimum Chi-Square of Linear fit, scalar
q - chi-sq probability, scalar (0-1) giving the probability that
a correct model would give a value equal or larger than the
observed chi squared. A small value of q indicates a poor
fit, perhaps because the errors are underestimated.
common fitexy, communicates the data for computation of chi-square.
CHISQ_FITEXY() ;Included in this file
MINF_BRACKET, MINF_PARABOLIC, ZBRENT ;In IDL Astronomy Library
MOMENT(), CHISQR_PDF() ;In standard IDL distribution
From "Numerical Recipes" column by Press and Teukolsky:
in "Computer in Physics", May, 1992 Vol.6 No.3
Also see the 2nd edition of the book "Numerical Recipes" by Press et al.
Written, Frank Varosi NASA/GSFC September 1992.
Now returns q rather than 1-q W. Landsman December 1992
Converted to IDL V5.0 W. Landsman September 1997
Use CHISQR_PDF, MOMENT instead of STDEV,CHI_SQR1 W. Landsman April 1998
Fixed typo for initial guess of slope, this error was nearly
always insignificant W. Landsman March 2000
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]