[SciPy-user] scipy.optimize.leastsq error estimates

Nils Wagner nwagner@iam.uni-stuttgart...
Tue Feb 6 02:14:08 CST 2007


Christian Kristukat wrote:
> Ewald Zietsman wrote:
>   
>> Hi all,
>>
>> I want to fit a sinusoid of the form A*cos(2*pi*f*t) + B*sin(2*pi*f*t)
>> to irregularly spaced data so that I can get a wave of the  form
>> C*cos(2*pi*f*t + phi) where C**2 = A**2 + B**2 and phi = arctan(-B/A). I
>> have implemented this using the leastsq function but, I'd would like to
>> also know the variances ( or standard errors ) of A,B and f. Is there a
>> way I can get the variance-covariance matrix out from leastsq? or at
>> least get a good estimate of the standard errors of my unknowns?
>>     
>
> When setting full_output=True leastsq will return the covraiance matrix:
>
>       cov_x -- uses the fjac and ipvt optional outputs to construct an
>                estimate of the covariance matrix of the solution.
>                None if a singular matrix encountered (indicates
>                infinite covariance in some direction).
>
> However I recommend using scipy.sandbox.odr instead which returns confidence
> intervals for all parameters.
>
> Christian
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>   
 
AFAIK odr is directly available through scipy.odr.
So I guess the odr directory in the sandbox is obsolete. Is that correct ?

Nils



More information about the SciPy-user mailing list