Plotly Survival Curve
Group A Step Table
| Time | At Risk | Events | Censored | Survival | Lower CI | Upper CI |
|---|
Group B Step Table
| Time | At Risk | Events | Censored | Survival | Lower CI | Upper CI |
|---|
Calculator Inputs
Enter time and event pairs as two columns. Use 1 for event and 0 for censored. One record per line.
Example Data Table
This sample illustrates a simple two-group survival dataset. Time units can represent days, weeks, or months.
| Record | Group | Time | Event | Meaning |
|---|---|---|---|---|
| 1 | Group A | 5 | 1 | Event observed at time 5 |
| 2 | Group A | 6 | 1 | Event observed at time 6 |
| 3 | Group A | 6 | 0 | Censored at time 6 |
| 4 | Group A | 10 | 0 | Censored at time 10 |
| 5 | Group B | 4 | 1 | Event observed at time 4 |
| 6 | Group B | 5 | 1 | Event observed at time 5 |
| 7 | Group B | 5 | 0 | Censored at time 5 |
| 8 | Group B | 9 | 0 | Censored at time 9 |
Formula Used
- Kaplan-Meier survival estimate: S(t) = ∏(1 − di / ni) for each event time up to t.
- Greenwood variance: Var[S(t)] = S(t)2 × Σ[di / (ni(ni − di))].
- Log-rank expected events: E1i = di × n1i / ni.
- Log-rank variance contribution: Vi = n1in2idi(ni − di) / [ni2(ni − 1)].
- Log-rank chi-square: χ² = (O1 − E1)² / V.
- Approximate hazard ratio: HR ≈ exp[(O1 − E1) / V].
- Restricted mean survival time: RMST(τ) = ∫0τ S(t) dt.
- Median survival: the earliest time where estimated survival becomes 0.50 or lower.
This implementation uses right-censored data and a one-degree-of-freedom log-rank comparison between two groups.
How to Use This Calculator
- Enter a name for each group.
- Paste one observation per line using time and event status.
- Use 1 for observed events and 0 for censored observations.
- Select the confidence level for interval estimates.
- Enter a horizon time if you need survival at a specific point.
- Set τ for restricted mean survival time comparison.
- Click Compare Survival Curves to calculate the results.
- Review medians, RMST, p-value, hazard ratio, and step tables.
- Use the CSV or PDF buttons to export the summary.
Frequently Asked Questions
1) What does this calculator compare?
It compares two time-to-event datasets. The tool estimates Kaplan-Meier survival curves, calculates median survival, computes restricted mean survival time, and performs a log-rank test to assess whether the groups differ statistically.
2) What does event = 0 mean?
An event value of 0 means the observation is censored. The subject remained event-free until that time, but the final outcome was not observed afterward.
3) Can I use months, weeks, or days?
Yes. Any time unit works if both groups use the same unit consistently. Mixing units inside one analysis will distort the survival curve and the comparison.
4) What does the log-rank p-value show?
The p-value tests whether the two survival experiences differ over the full follow-up period. A small p-value suggests the groups likely do not share the same underlying survival pattern.
5) Why might median survival be not reached?
Median survival is not reached when the estimated survival curve never falls to 50% or below during observed follow-up. In that case, longer follow-up may be needed.
6) What is RMST useful for?
RMST summarizes average event-free time up to a chosen limit τ. It is useful when hazards are not proportional or when median survival is unavailable or unstable.
7) Is the hazard ratio exact?
The displayed hazard ratio is an approximation derived from the log-rank framework. It is useful for quick comparison, but it is not a replacement for a full Cox model.
8) What should I check before interpreting results?
Check data entry, time units, censoring codes, follow-up length, and sample size. Also consider whether group differences might depend on study design, missing data, or confounding factors.