Repository navigation
Fix bootstrap CI scaling and selection.random standardization - #176
Merged
Merged
Conversation
Each bootstrap resample draws bootstrap.sample * n of the n subjects (an m-out-of-n bootstrap), so the spread of the bootstrap estimates reflects a sample of size m and the standard errors and confidence intervals were about 1 / sqrt(bootstrap.sample) times too wide - about 12% at the default of 0.8. The draws are now shrunk towards the full-data estimate by sqrt(bootstrap.sample) before the SE or percentile interval is taken, for the risks and their differences and ratios, hazard ratios, and end-of-follow-up estimates. Results with bootstrap.sample = 1 are unchanged.
selection.random keeps a proportion selection.prob of the trials starting on the first level of treat.level, but the risk curves and the hazard-ratio simulation standardized over the kept trials unweighted, under-representing that arm's covariate distribution: in SEQdata with selection.prob = 0.3 both ITT risks at follow-up 60 averaged about 0.011 too high over 20 seeds. Kept first-level trials now carry weight 1 / selection.prob in the standardization and in the hazard-ratio Cox fit, which removes the bias. The outcome and weight models are unchanged, as selection depends only on baseline treatment. Bootstrap CIs already include the selection variability (resampling subjects from the kept trials is equivalent to resampling then selecting; checked by simulation), so the documentation now says so instead of changing them.
ryan-odea
approved these changes
Nov 8, 2026
ryan-odea
left a comment
Collaborator
There was a problem hiding this comment.
Sorry for the delay - took me a bit to wrap my head around the issue.
Looks good!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bootstrap sampling option has been niggling away at the back of my mind. I believe it needs this rescaling
sqrt(bootstrap.sample)so SEs and CIs refer to the full sample size; they were about 12% too wide at the default of 0.8. Ratios are rescaled on the log scale.And this also
selection.randomby1 / selection.probwhen standardizing risks and fitting the hazard-ratio Cox model, removing a bias in the risks.