Skip to content

Fix mr_mode bootstrapping#685

Merged
remlapmot merged 7 commits into
MRCIEU:masterfrom
remlapmot:fix-mr-mode
Jun 24, 2026
Merged

Fix mr_mode bootstrapping#685
remlapmot merged 7 commits into
MRCIEU:masterfrom
remlapmot:fix-mr-mode

Conversation

@remlapmot

Copy link
Copy Markdown
Contributor

This,

  • Fixed inflated bootstrap standard errors (and p-values) in mr_mode() and mr_rucker_bootstrap() introduced in v0.6.30. The pre-generated rnorm() matrix was filled column-by-column while the per-SNP means and standard errors recycled element-wise, so each bootstrap draw was taken from the wrong SNP's distribution; the means and SEs are now laid out with rep(..., each = nboot) so each column draws from its own SNP. Point estimates were unaffected. (thanks @peterk87 reported in [BUG]: mr_mode() bootstrap SE inflated since v0.6.30 due to incorrect matrix fill in boot() #684)
  • Fixed mr_rucker_bootstrap() which errored ("values must be length 1") because it accessed the per-combination result ($rucker, $Q, $res, $selected) directly while mr_rucker() returns a list with one element per exposure-outcome combination; it now unwraps the first element.
  • Fixed mr_rucker_cooksdistance(), which had the same return-shape problem: $cooksdistance was NULL so the Cook's distance filtering loop never ran and a malformed object was returned; it now unwraps the first element.
  • Added regression tests for the mr_mode() and mr_rucker_bootstrap() bootstrap standard errors and for mr_rucker_cooksdistance().

Closes #684

@remlapmot remlapmot merged commit 3d119f2 into MRCIEU:master Jun 24, 2026
13 checks passed
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.

[BUG]: mr_mode() bootstrap SE inflated since v0.6.30 due to incorrect matrix fill in boot()

1 participant