Skip to content

Fix calibrateEB interpolation threshold condition#787

Open
sims1253 wants to merge 1 commit into
imbs-hl:masterfrom
sims1253:ry-fix-calibration-threshold
Open

Fix calibrateEB interpolation threshold condition#787
sims1253 wants to merge 1 commit into
imbs-hl:masterfrom
sims1253:ry-fix-calibration-threshold

Conversation

@sims1253

Copy link
Copy Markdown

calibrateEB() chooses between an exact gbayes() evaluation and a faster interpolation according to the number of variance estimates. The condition length(vars >= 200) measured the comparison result rather than vars, so it was true for every non-empty input and left the exact branch unreachable.

Use length(vars) >= 200, as described by the existing comment, so inputs below the threshold use the exact calculation. Both paths target the same posterior, so the practical numerical difference is small.

Add regression coverage for exact evaluation below the threshold and a sanity check of interpolation at the threshold.

Found during my https://github.com/sims1253/ry audit

calibrateEB() chooses between an exact gbayes() evaluation and a faster
interpolation according to the number of variance estimates. The
condition `length(vars >= 200)` measured the comparison result rather
than vars, so it was true for every non-empty input and left the exact
branch unreachable.

Use `length(vars) >= 200`, as described by the existing comment, so
inputs below the threshold use the exact calculation. Both paths target
the same posterior, so the practical numerical difference is small.

Add regression coverage for exact evaluation below the threshold and a
sanity check of interpolation at the threshold.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant