Add risk_times option, ensure stable factor encoding, and a css tweak#49
Merged
Conversation
… in the outcome model
_calculate_risk predicted the discrete hazard on followup = 1..followup_max, which silently dropped the first interval's hazard (followup = 0, where an event can already occur in the expanded data) and ended the curve one step short. The first survival step used h(1) instead of h(0), shifting every point and biasing risks downward. Predict on the full grid (0..followup_max) and shift the curve labels +1 after the cumulative product so followup = k means "survival/risk after k elapsed intervals", giving rows 0..followup_max+1. The shift is applied before _store_boot_risks and the bootstrap CI join, so _boot_risks, _resolve_risk_times, and the paired RD/RR computation stay aligned. This matches the SEQTaRget (R) survival output.
ryan-odea
approved these changes
May 27, 2026
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.
This adds the two most recent additions to the R package:
Add
risk_timesoptionEnsure stable factor encoding for categorical time-varying covariates in the outcome model
Also I find the top nav bar on the readthedocs a bit too tall (it even obscures some of the side menus sometimes), e.g., screenshot of https://pyseqtarget.readthedocs.io/en/latest/ in Chrome
So I've tweaked with the css for that,