REGRESS function performs a multiple
fit and returns an
-element column vector of coefficients.
REGRESS fits the function:
+ ... +
This routine is written in the IDL language. Its source code can be found in the file
subdirectory of the IDL distribution.
Result = REGRESS(
X, Y, Weights [, Yfit, Const, Sigma, Ftest, R, Rmul, Chisq, Status]
array of independent variable data, where
is the number of coefficients (independent variables) and
is the number of samples.
-element vector of dependent variable points.
-element vector of weights for each equation. For instrumental (Gaussian) weighting, set
. For statistical (Poisson) weighting,
. For no weighting, set
= 1.0, and set the RELATIVE_WEIGHT keyword.
A named variable that will contain an
-elements vector of calculated values of
A named variable that will contain the constant term.
A named variable that will contain the vector of standard deviations for the returned coefficients.
A named variable that will contain the value of F for test of fit.
A named variable that will contain the vector of linear correlation coefficients.
A named variable that will contain the multiple linear correlation coefficient.
A named variable that will contain a reduced, weighted chi-squared.
A named variable that will contain the status of the internal array inversion computation.
will contain 0 (zero) if the array was successfully inverted.
will contain the integer 1 (one) if the array was not successfully inverted because it is singular.
will contain the integer 2 (two) if there is a possibility that the result of the inversion--and the resulting coefficients returned by REGRESS--is inaccurate due to the use of a small pivot element.
If this keyword is set, the input weights (the
vector) are assumed to be relative values, and not based on known uncertainties in the
vector. Set this keyword in the case of no weighting.
X = [[0.0, 0.0], $
[2.0, 1.0], $
[2.5, 2.0], $
[1.0, 3.0], $
[4.0, 6.0], $
Y = [5.0, 10.0, 9.0, 0.0, 3.0, 27.0]
weights = REPLICATE(1.0, N_ELEMENTS(Y))
result = REGRESS(X, Y, weights, yfit, const, /RELATIVE_WEIGHT)
PRINT, const, result, result
5.00000 4.00000 -3.00000