Home »
Public Forums »
archive »
Problem with REGRESS.PRO
Problem with REGRESS.PRO [message #56] |
Sat, 10 August 1991 21:51 |
landsman
Messages: 93 Registered: August 1991
|
Member |
|
|
We recently have been having trouble interpreting results using the REGRESS
function in the IDL User's Library. We found the culprit was that REGRESS
is not a faithful implementation of the Bevington function REGRES when one
is using relative weights. For example, the documentation to REGRESS says
that for no weighting one should set the weight vector W equal to 1 for all
points. This will give the correct function coefficients, but the incorrect
deviations of the coefficients (parameter SIGMA). The reason is that
REGRESS has to know that the input W vector contained relative weights, so
that it can estimate the "real" weights from the fitted data. This is done
with the MODE parameter in the Bevington routine.
As a tentative fix, we have added a keyword RELATIVE_WEIGHT to the function,
which one would include when the W vector contains relative weights. The
following line in the program
sigma = sqrt(array(indgen(nterm)*(nterm+1))/wmean/(nfree*sigmax^2))
is then changed to (c.f. Bevington p. 175)
IF KEYWORD_SET(relative_weight) then varnce = chisq $
else varnce = 1./wmean
sigma = sqrt(array(indgen(nterm)*(nterm+1))*varnce/(nfree*sigmax^2))
As a side remark, I wish the visual appearance and program comments of some
of the User Library routines were cleaned up. (FIX THOSE PROGRAMS WRITTEN IN
ALL CAPS.) It's not a big deal, but these program often serve as the
main examples while learning to program in IDL
|
|
|
Current Time: Wed Oct 08 11:37:43 PDT 2025
Total time taken to generate the page: 0.00520 seconds