[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Waldhäuser Str. 64, D-72076 Tübingen, Germany
[Uni logo]


FITEXY Source code in fitexy.pro

FITEXY

Name
       FITEXY
Purpose
       Best straight-line fit to data with errors in both coordinates
Explanation
       Linear Least-squares approximation in one-dimension (y = a + b*x),
               when both x and y data have errors
Example
       FITEXY, x, y, A, B, X_SIG= , Y_SIG= , [sigma_A_B, chi_sq, q, TOL=]
Input Parameters
       x = array of values for independent variable.
       y = array of data values assumed to be linearly dependent on x.
Required Keywords
       X_SIGMA = scalar or array specifying the standard deviation of x data.
       Y_SIGMA = scalar or array specifying the standard deviation of y data.
Keyword Parameters
       TOLERANCE = desired accuracy of minimum & zero location, default=1.e-3.
Output Parameters
       A_intercept = constant parameter result of linear fit,
       B_slope = slope parameter, so that:
                       ( A_intercept + B_slope * x ) approximates the y data.
Optional Output
       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 Blocks
       common fitexy, communicates the data for computation of chi-square.
Procedures Used
       CHISQ_FITEXY()            ;Included in this file
       MINF_BRACKET, MINF_PARABOLIC, ZBRENT    ;In IDL Astronomy Library
       MOMENT(), CHISQR_PDF()     ;In standard IDL distribution
Procedure
       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.
Revision History
       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

Last modified by pro2html on 2001 April 26 at 03:13 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically