[SciPy-User] optimize.leastsq hessian approx. inversion?

Udo Hoefel ostrakismus at yahoo.de
Thu Apr 28 03:58:50 EDT 2016


Hi,

I'm currently using scipy.optimize.leastsq to do a fit, to get to the 
covariance matrix, I use
self.s_sq = 
(infodict['fvec']**2).sum()/(self.Max_Dist_Between_Dips-(2*(max(self.Channel_List)-1)+1))
self.pcov = cov_x*self.s_sq
wherein self.Max_Dist_Between_Dips = Number of Datapoints and 
(2*(max(self.Channel_List)-1)+1) the number of free parameters.
This is according to the documentation, I believe (and one question 
here, https://mail.scipy.org/pipermail/scipy-user/2013-March/034316.html )
My (probably stupid) question is the following:
As I understand, cov_x is the unscaled Hessian, right?
Shouldn't I have to invert it at some point, to get to the Covariance?
My guess would have been something like
self.pcov = self.s_sq*np.linalg.inv(cov_x)

Big thanks in advance for any hint,
Udo



More information about the SciPy-User mailing list