Can lmfit fit the data with asymmetric errorbars?

616 views
Skip to first unread message

Zhi Chang

unread,
Jan 20, 2016, 3:59:27 AM1/20/16
to lmfit-py

Now I have some data, and some have symmetric errorbars , but some just have a asymmetric errorbars (upper limit or lower limit).

Can lmfit do a fit with these data?

Matt Newville

unread,
Jan 21, 2016, 10:18:52 PM1/21/16
to lmfit-py
Hi Zhi,

(I sent this earlier to Zhi only, and am resending to the whole group)

On Wed, Jan 20, 2016 at 2:59 AM, Zhi Chang <changz...@gmail.com> wrote:

Now I have some data, and some have symmetric errorbars , but some just have a asymmetric errorbars (upper limit or lower limit).
 
Can lmfit do a fit with these data?


Hm, interesting question.  Do I understand correctly that some of the *data* has asymmetric errorbars and you want that reflected in the weighting done for the fit? 

Obviously (I hope), for data with symmetric errorbars one can use the standard error as the weighting of the residual.   I'm not sure how one best uses the full asymmetric errorbars to weight the residual in any fit, not just with lmfit. 

I suppose one could do a calculation in the objective function that was somewhat more involved than
     residual = (data - model) / epsilon

that changed the value of epsilon for each data point based on the sign of (data - model).    I'd be sort of surprised to see a case where that makes a very big difference, and it doing a point-by-point check (or even using numpy's where function) of (data - model) to decide on epsilon would have a performance hit.

You could also perform many fits to "data" taken from samples of your data+errorbars, Monte Carlo style, and use the composite of those results.   That could easily support asymmetric errorbars on the data.
 --Matt
Reply all
Reply to author
Forward
0 new messages