[SciPy-Dev] On the leastsq/curve_fit method

Gianfranco Durin g.durin@inrim...
Tue Sep 27 04:17:40 CDT 2011


> where func can be both "_general_function" and
> "_weighted_general_function", is not correct.
> 
> 
> M = σ 2 I ok unit weights
> 
> M = W^(-1) your case, W has the estimates of the error covariance
> 
> M = σ 2 W^(-1) I think this is what curve_fit uses, and what is in
> (my) textbooks defined as weighted least squares
> 
> Do we use definition 2 or 3 by default? both are reasonable
> 
> 3 is what I expected when I looked at curve_fit
> 2 might be more useful for two stage estimation, but I didn't have
> time to check the details

Ehmm, no, curve_fit does not use def 3, as the errors would scale with W, but they don't. By the way, it does not have the correct units.

Curve_fit calculates

M = W \sigma^2 W^(-1) = \sigma^2

so it gives exactly the same results of case 1, irrespective the W's. This is why the errors do not scale with W.

Gianfranco


More information about the SciPy-Dev mailing list