Prevent NaN values for LLR - #881
Conversation
|
Some example outputs for very one-sided matches: |
|
As pointed out by @vondele, the acceptance of H0 in the above example is probably wrong. I also tried - lpr[i] = std::log(regularize(p1[i])) - std::log(regularize(p0[i]));
+ lpr[i] = std::abs(p0[i]) > std::abs(p1[i]) ? std::log(regularize(p1[i]/p0[i])) : -std::log(regularize(p0[i]/p1[i]));but that did not improve the situation much. The problem is that in practice these p_i can actually be (very) negative. So a more sophisticated fix within the Putting this to draft for now. |
|
The ability for us to find a solution for the Lagrangian multiplier θ depends on a good value for the initial values for p, since we iterate. In this extremal case a uniform prior doesn't work. Would have to think how best to handle this. The lazy solution would be to bail out and to fall back to an approximation, but that feels inelegant. Edit: Going to continue discussion on #879. |
|
Closing in favour of #882. |
This patch attempts to avoid NaN return values for the LLR computations.
I am not sure whether mathematically this is the most sound approach. So a review by @87flowers or @vdbergh would be great.
Fixes #879.