[SciPy-dev] least squares error

Ondrej Certik ondrej@certik...
Mon Mar 9 08:16:03 CDT 2009


Hi,

I think each time I used leastsq, I also needed to calculate the
errors in the fitted parameters. I use this method, that takes the
output of leastsq and returns the parameters+errors.

def calc_error(args):
    p, cov, info, mesg, success = args
    chisq=sum(info["fvec"]*info["fvec"])
    dof=len(info["fvec"])-len(p)
    sigma = array([sqrt(cov[i,i])*sqrt(chisq/dof) for i in range(len(p))])
    return p, sigma

let's integrate this with leastsq? E.g. add a new key in the info dict?

Ondrej


More information about the Scipy-dev mailing list