svdfit with multiple vectors...


Kevin Dolan
07-24-2002, 09:03 AM
I have a problem which requires me to do two different fits with the same functions. Specifically, I call svdfit twice, both times with the same vector 'x' and the same function 'funcs', but with diferent vectors for 'y'.

My problem is this: When I feed the results of these two different fits into the function svdvar, I get the same covarience matrix for both fits, even though the vector 'y' that the fit is being made to is different. I am guessing that this must be a bug somewhere in my code, but I want to make sure that I am not seriously misunderstanding how these algorithms work.

Thanks,

Kevin Dolan

Bill Press
07-25-2002, 09:45 AM
Kevin,
It's not a bug at all! If you look at NR equations 15.4.8 and 15.4.14, you'll see that the standard errors in a least squares fit actually don't depend on the data values, but rather only on the positions of the data points (in x), the standard deviations of the data, and the values of the fitted functions at the fitted points.
The derivation is using the Normal Equations, but SVD is just a numerically more stable method of getting mathematically equivalent results.
Good luck!

Kevin Dolan
07-26-2002, 05:20 AM
I see. I was apparently misinterpreting what the covariance matrix is.

So unless I am mistaken, the covariance matrix is not in any way an estimate of the quality of the fit? Is that correct? If so, can anyone tell me what the appropriate way to determine the quality of the fit would be?

Thanks,

Kevin Dolan