[SciPy-Dev] parameters of fitting data

josef.pktd@gmai... josef.pktd@gmai...
Tue Nov 22 16:24:26 CST 2011


On Tue, Nov 22, 2011 at 5:22 PM,  <josef.pktd@gmail.com> wrote:
> On Tue, Nov 22, 2011 at 3:56 PM, Krzysztof Berniak
> <krzysztof.berniak@gmail.com> wrote:
>> Hello,
>>   I'm writing script in python, which fitting exponencial curve to data (
>> f(x) = a*exp(x*b).
>>  To resolve this problem I use scipy.
>>  It works fine. I get in v1 new parameters, but where is calculation errors
>> of this parameters ?
>> When I use gnuplot my results look like this:
>> Final set of parameters            Asymptotic Standard Error
>> =======================            ==========================
>> a1              = 12.1566                                   +/- 0.2286
>> (1.88%)
>> b1              = 0.000858396                           +/- 4.362e-006
>> (0.5082%)
>>
>>   ^
>>
>>
>>   |
>>                                                                where in
>> scipy i get this numbers
>> This is my code
>> def main():
>>     z,f = numbers_col()
>>     fitfunc = lambda v, z: v[0]*exp(z*v[1])
>>     errfunc = lambda v, z,f: fitfunc(v,z) - f
>>     v0 = [10., 0.005]
>>     v1,success = optimize.leastsq(errfunc, v0[:], args =
>> (z,f),full_output=True)
>> regards and please help,
>> Cristopher
>
> use optimize.curvefit

curve_fit

Josef

which returns the covariance matrix for the
> parameter estimates, and np.sqrt(np.diag(cov)) gives the standard
> errors for each parameter estimate.
>
> Josef
>
>> _______________________________________________
>> SciPy-Dev mailing list
>> SciPy-Dev@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>
>>
>


More information about the SciPy-Dev mailing list