-
-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
includes RMST, difference in RMST and confidence intervals #1526
base: master
Are you sure you want to change the base?
includes RMST, difference in RMST and confidence intervals #1526
Conversation
Implements RMST, difference in RMST from the R package: https://cran.r-project.org/package=survRM2 Includes RMST of one population (point estimate and confidence interval), difference in RMST of 2 populations (point estimate, p-value, and confidence intervals). Addresses CamDavidsonPilon#821
@CamDavidsonPilon, I would very much appreciate your review (and approval, conditional on acceptance). My organization is really struggling without a sound method to generate confidence intervals on a difference in 2 survival populations. |
add check on point_in_time argument for difference in RMST
Hi @bayesfactor! Thanks for the PR (sorry about the delay). We have an |
@CamDavidsonPilon, thank you for your response. I'm sorry, I overlooked As you said, the main point of this pull request is to provide a confidence interval on difference in RMST, which is a new feature as far as I know. |
@CamDavidsonPilon, I'm hoping to hear back from you about whether you or I should include the other outputs from RMST, and therefore how to proceed with the difference in RMST (including confidence intervals) functionality. Can you please let me know what is your preference? |
Changes: 1. fixed an issue of returning NaN confidence intervals if the followup time `point_in_time` is greater than the last observed event. Using `.replace(np.inf, 0)`, we correct the issue and return correct confidence intervals for that edge case. 2. cosmetic refactoring to do less recalculation and rely more on pre-calculated values stored in `fitterA`
I fixed an issue with RMST where, if the followup interval is greater than the last observed event, the confidence intervals were NaN. The latest commit resolves that issue and makes some minor refactoring for efficiency. @CamDavidsonPilon, I'm hoping to hear back from you about whether you or I should include the other outputs from RMST, and therefore how to proceed with the difference in RMST (including confidence intervals) functionality. Can you please let me know what is your preference? |
wk_var = wk_var.tolist() + [0] | ||
rmst_var = sum((np.flip(areas[1:])).cumsum() ** 2 * np.flip(wk_var)[1:]) | ||
wk_var = wk_n_event.observed / (wk_n_risk * (wk_n_risk - wk_n_event.observed)) | ||
wk_var = wk_var.replace(np.inf, 0).tolist()[1:] + [0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the part that fixes the NaN issue. By adding .replace(np.inf, 0)
, the confidence intervals are not NaN now.
Hi @bayesfactor, Thanks for keeping up with this! Can you explain how this works for parametric fitters? In my head, to compute the AUC of a parametric fitter, some |
Great point, this won't work for all fitters. The current implementation depends on a I don't know how often people use other fitters; I could lifelines/lifelines/utils/__init__.py Line 209 in c9b136b
|
I think we can combine the functions! Have a global |
upon further thought, should we push one step further upstream and give all fitters an |
…ers get an event_table
Unless I'm missing something, my last commit moved the |
Implements RMST, difference in RMST from the R package: https://cran.r-project.org/package=survRM2
Includes RMST of one population (point estimate and confidence interval), difference in RMST of 2 populations (point estimate, p-value, and confidence intervals). Addresses #821