Repository navigation
[FIX] Negative sigma when fitting asymm. EGH through optimization - #3195
Conversation
| double abs_tau = fabs(tau_); | ||
| double phi = atan(abs_tau / sigma_); | ||
| double abs_sigma = fabs(sigma_); | ||
| double phi = atan(abs_tau / abs_sigma); |
There was a problem hiding this comment.
how can sigma ever by negative? This is supposed to be the square root of the variance ... if this is negative, then the fit failed, right? I think simply setting it to the absolute value is a hack but leads to very wrong results ... should it not just be zero then?
Also, do we have an example of such a degenerate case? maybe we can add it to the tests?
|
@timosachsenberg @jpfeuffer that looks like a short term fix but I think that its a pretty bad choice in terms of the area and the other parameters that will be derived from this. I think if it fails to fit we should set sigma either to zero or throw an exception |
|
Yes I have an example here. I can add it. I agree that it looks weird but I don't think that it's necessarily wrong to use the absolute value here. I think the negative values only arise if they were fitted through the LM procedure which tries to fit Sigma (not Sigma square) and can result in local optima with a negative value. Not an expert here though. I can check if the fits still make sense. |
I agree but I dont quite see how the absolute value is any more correct than using zero -- unless what you are really fitting is sigma_squared ? Still, if possible lets add the example. Does the area seem sensible when you look at the example - I am just a bit worried that the area calculation does not make any sense any more once you have negative values from the fit. |
Related to #3193