Standard Library function thatfits a curve to data using the multiple linear regression method.
y A vector containing the dependent values. Must have n elements.
wt A vector of weighting factors for determining the weighting of the multiple linear regression. Must have n elements.
a0 (optional) The constant term (offset) of the output function.
sig (optional) A vector containing the standard deviations for the coefficients.
ft (optional) The value of F in the standard F Test for the goodness of fit.
r (optional) A vector containing the linear correlational coefficients.
rm (optional) The multiple linear correlation coefficient.
c (optional) The value of X2 in the Chi-Squared test for the goodness of fit.
x = FLTARR(3, 9) x(0, *) = [0.,1.,2.,3.,4.,10.,13.,17.,20.] x(1, *) = [0.,3.,6.,9.,12.,15.,18.,19.,20.] x(2, *) = [0.,4.,8.,12.,13.,14.,15.,18.,20.] y = [5.,4.,3.,2.,2.,4.,5.,8.,9.]
wt = FLTARR(9) + 1.0 coeff = REGRESS(x,y,wt,yf,a0,sig,ft,r,rm,c)
PLOT, yf, title='REGRESS EXAMPLE'
PRINT, 'Fitted function:' PRINT, ' f(x) = ',a0,' +', $ coeff(0, 0),' x1 +', $ coeff(0, 1),' x2 +', $ coeff(0, 2),' x3' PRINT, 'Standard deviations for ' +$ 'coefficients: ', sig PRINT, 'F Test value:', ft PRINT, 'Linear correlation coefficients: ', r PRINT, 'Multiple linear correlation ' + 'coefficient: ', rm PRINT, 'Chi-squared value: ', c