[SciPy-User] robust fit
Sturla Molden
sturla at molden.no
Tue May 31 11:56:07 EDT 2011
Den 31.05.2011 17:39, skrev josef.pktd at gmail.com:
> Do you have a reference or a full example for this?
Yes, I'll look one up for you.
> Your description sounds relatively simple, and I guess now that we
> (statsmodels) can get the non-linear version with only small(ish)
> changes and a call to a WNLLS (curve_fit) instead of WLS (linear).
>
Yes and no. You have to provide an initial fit and derive the Jacobian
(unless you are happy with an approximation).
Also the "robust fit" (asked for here) is not just WNLLS, because the
weights are a non-linear function of the residuals. You can solve this
by iterative WNLLS, or provide the full Jacbobian directly to
Levenberg-Marquardt. In the former case, it is just sqrt(w) times the
Jacobian for the residuals. But you can also get the M-estimator from a
single pass of Levenberg-Marquardt by using the chain rule on
sqrt(w(e(x)))*e(x). So there are actually two ways of doing this with
leastsq.
Sturla
More information about the SciPy-User
mailing list