warn when restricted_mean_survival_time(return_variance=True) is used#1683
Open
laurapiro17 wants to merge 2 commits into
Open
warn when restricted_mean_survival_time(return_variance=True) is used#1683laurapiro17 wants to merge 2 commits into
laurapiro17 wants to merge 2 commits into
Conversation
The returned value is Var[min(T, t)] (variance of the truncated survival random variable), not the sampling variance Var[RMST_hat] of the estimator, and is therefore unsuitable for confidence intervals or hypothesis tests on RMST. Users were silently constructing wrong inference (see the reproduction in CamDavidsonPilon#1682, ~6x SE inflation on the bundled waltons miR-137 subset). Emit a UserWarning when return_variance=True is passed and document the semantics in the docstring. Add a test covering both the model and survival-function code paths. Refs CamDavidsonPilon#1682.
Silence the UserWarning emitted in two existing RMST tests (test_rmst_works_at_kaplan_meier_with_left_censoring and test_rmst_variance) by asserting the warning is raised, rather than leaking it to test output.
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.
refs #1682.
restricted_mean_survival_time(..., return_variance=True)returnsVar[min(T, t)](variance of the truncated survival RV), not the sampling variance of the RMST estimator. anyone using it for confidence intervals or hypothesis tests silently gets the wrong answer — on the bundledwaltonsmiR-137 subset at τ=10 the reported SE is ~6× the survRM2/greenwood reference.this PR is the smallest fix while #1526 (greenwood-based variance) is in review:
UserWarningwhenreturn_variance=Trueis usedreturn_variance=Truewithpytest.warnssurvival_function_paths, and that the default call stays silentdoesn'''t change the numeric return value or implement greenwood — that belongs in #1526.
tested locally:
pytest -k rmst→ 7 passed.