[SciPy-user] negative values in diagonal of covariance matrix

Pauli Virtanen pav@iki...
Fri Dec 12 03:25:06 CST 2008


Fri, 12 Dec 2008 13:49:55 +0900, David Cournapeau wrote:
> Do you mean the python wrapper miss some diagnostic information
> available in fortran ? Otherwise, would it make sense to check the ier
> value from fortran and at least generate a warning about failed
> convergence ?

The Python wrapper to minpack.lmder is quite thin, I'd expect any 
problems to be in the MINPACK code itself (which is actually LMDIF and 
not LMDER as I wrote earlier). The algorithm itself is something like 
Levenberg-Marquardt with a trust region.

Unless the problem is in the minpack.leastsq code that forms the cov_x 
matrix from return values of LMDIF:

        perm = take(eye(n),retval[1]['ipvt']-1,0)
        r = triu(transpose(retval[1]['fjac'])[:n,:])
        R = dot(r, perm)
        cov_x = inv(dot(transpose(R),R))

I don't have the time to check this now, though.

-- 
Pauli Virtanen



More information about the SciPy-user mailing list