[SciPy-user] scipy.optimize.leastsq and covariance matrix meaning
Robert Kern
robert.kern@gmail....
Thu Nov 6 15:11:46 CST 2008
On Thu, Nov 6, 2008 at 09:10, massimo sandal <massimo.sandal@unibo.it> wrote:
> Hi,
>
> I have a trouble with the covariance matrix in the output of
> scipy.optimize.leastsq . I am trying to find the estimated sigma of the
> parameters obtained by the fit. Please bear with me since my statistics
> knowledge is poor. I understand that the diagonal of the covariance matrix
> should return me the variance values of each parameter.
>
> Problems are:
> 1) The variance of such parameters look unreasonably large to me, despite
> the fact I obtain an *excellent* fit over a lot of data points (and values
> extremly well coherent with expected).
The variance of the point estimate of the paremeters is not
necessarily related to the goodness of fit. It may just mean that your
parameters can change significantly without affecting the fit. Try
generating random parameters using the covariance matrix and
numpy.random.multivariate_normal() and seeing how well they fit.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-user
mailing list