Standard Library function thatfits a curve to data using the multiple linear regression method.
y
wt
a0
sig
ft
r
rm
c
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