include median confidence interval in estimates?
See original GitHub issueHello,
Would it make sense to include median confidence intervals in the estimates? For example, in the object returned from KaplanMeierFitter()
, after fitting, one could do:
# get the confidence interval of the median
# start by finding the median on the timeline
median_ci_idx = kmf.confidence_interval_.index.get_loc(median_lifespan,
method='nearest')
# then get the confidence interval at the point of the median
median_ci = kmf.confidence_interval_.iloc[median_ci_idx]
# to find the confidence interval for the value of the median
# we will get a horizontal line passing through the value of the
# median; note that the greater value comes earlier, and the smaller later
lcl = (kmf.survival_function_['KM_estimate']
<= median_ci.loc['KM_estimate_upper_0.95']).idxmax(0)
ucl = (kmf.survival_function_['KM_estimate']
<= median_ci.loc['KM_estimate_lower_0.95']).idxmax(0)
This is what is essentially done by R, as explained in print.survfit.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to Find a Confidence Interval for a Median (Step-by-Step)
Step 3: Find the Confidence Interval ... The 95% confidence interval for the median will be between the j = 4 th and...
Read more >19.1 - For A Median | STAT 415
We can therefore be 93.64% confident that the population median falls in the interval (3.15, 5.35). ... In general, we should aim to...
Read more >Concept: Confidence Interval of Median
A confidence interval is usually: estimate ±1.96 * S.E.. Formula provided by KC: R = FLOOR ( ( (nobs+1) /2) - ((nobs) **0.5)/2 ......
Read more >Confidence intervals for median - Cross Validated
I have a distribution of samples with a small number of values in each one (less than 10). I have calculated the median...
Read more >Confidence interval for a median and other quantiles
In Section 4.5 we estimated medians and other quantiles directly from the frequency distribution. We can estimate confidence intervals for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am sorry, now I see why it didn’t work for me. The function behaves differently depending on what you have on the input. I used
median_survival_times(kmf)
instead ofmedian_survival_times(kmf.confidence_interval_)
and only got the median time. I would suggest updating the documentation on this function. The parameters description uses “or” and I thought that it makes no difference if I use the model class or the confidence interval DataFrame.I’m not sure I’m seeing the same thing as you:
returns two values, 1.383272 & 1.418151