[SciPy-user] nonlinear fit with non uniform error?

massimo sandal massimo.sandal@unibo...
Thu Jun 21 08:46:49 CDT 2007

David Huard ha scritto:
> Hi,
> What you have is an heteroscedastic normal distribution (varying 
> variance) describing the residuals.
> 2007/6/21, Matthieu Brucher <matthieu.brucher@gmail.com 
> <mailto:matthieu.brucher@gmail.com>>:
>         1)Does this mean that least squares is NOT ok?
>     Yes, LS is _NOT_ OK because it assumes that the distribution (with
>     its parameters) is the same for all errors. I don't remember
>     exactly, but this may be due to ergodicity 
> Well, let's put things in perspective. You can still use ordinary 
> least-squares.  Theoretically, this means you're making the assumption 
> that the error mean and variance are fixed and constant.   In your case, 
> this is not true and you can consider the LS solution like an 
> approximation. What will happen under this approximation is that large 
> errors on Cy will tend to dominate the residuals, and values in Ay will 
> probably not be fitted optimally. I advise you try it anyway and 
> visually check whether you care about that or not.

Yes, it's what I already do, and works fairly well.
I'd like to see how *better* becomes. It can be useful in some contexts, 
so I wanted to know how to implement it.

> Or maximize the likelihood of a multivariate normal distribution, whose 
> covariance matrix describes your assumption about the heteroscedasticity 
> of the residuals.
> \Sigma =
> | \sigma_A^2       0                0                 |
> |      0             \sigma_B^2     0                 |
> |      0                    0              \sigma_C^2 |
> Heteroscedastic likelihood = -n/2 \ln(2\pi) - 1/2 \sum \ln(\sigma_i^2) 
> -1/2 \sum \sigma_i^{-2} (y_{obs} - y_{sim})^2
> You might also consider the possibility that your errors are 
> multiplicative rather than additive. In this case, describing the 
> residuals by a lognormal distribution could make more sense.
> Maximize lognormal likelihood:  L=lognormal(y_sim | ln(y_obs), \sigma)

I'll try to make sense of it...


Massimo Sandal
University of Bologna
Department of Biochemistry "G.Moruzzi"

snail mail:
Via Irnerio 48, 40126 Bologna, Italy


tel: +39-051-2094388
fax: +39-051-2094387
-------------- next part --------------
A non-text attachment was scrubbed...
Name: massimo.sandal.vcf
Type: text/x-vcard
Size: 274 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20070621/ed33549e/attachment.vcf 

More information about the SciPy-user mailing list