> For the complete documentation index, see [llms.txt](https://docs.owkin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.owkin.com/explore-and-analyse-data/data-analysis/survival-outcomes/kaplan-meier-survival-curves.md). Agents can also search and read this documentation through its [MCP server](https://docs.owkin.com/~gitbook/mcp).

# Kaplan–Meier survival curves

Estimate survival probabilities over time using Kaplan–Meier curves, for an entire cohort or separately for groups defined by a clinical variable.

Estimate survival probabilities over time using Kaplan–Meier curves, for an entire cohort or separately for groups defined by a clinical variable.

## Kaplan-Meier survival curves

### Description

#### Analysis summary

Estimates, for the cohort, the probability of remaining free of the event over time (e.g. overall survival, progression-free survival), optionally one curve per level of a single grouping variable.

#### Computation

A Kaplan-Meier estimator is fitted per group (or a single 'Overall' curve when no group is given): at each event time the survival probability is the share of patients still at risk who have not yet had the event, with patients leaving the cohort without the event (censored) withdrawn from the at-risk count. The descriptive stats table carries, per curve, the patient and event counts, the median survival time with its 95% confidence bounds, and the time at which survival drops through 10/25/50/75/90% — None where the curve never reaches that level. Statistical tests compare survival between the groups: for two groups a pairwise Cox proportional-hazards regression, for more a global Cox test plus pairwise comparisons (log-rank when the Cox model fails to converge), with p-values FDR-adjusted for the multiple comparisons and the group with the longer survival named per contrast.

#### When to use

Use for time-to-event questions: overall survival, progression-free survival, time to relapse, optionally broken down by a categorical variable (tumour stage, treatment arm). For hazard-ratio 'prognostic effects' of one or more clinical variables, use survival\_analysis instead.

#### Caveats

The estimator treats censored patients as event-free until they leave the cohort, so heavy or informative censoring biases the curves. Confidence bounds and medians are unstable near the tail, where few patients remain at risk; the CI band is not drawn below five patients in a curve. Comparisons assume no time-varying confounding.

### Example questions

<details>

<summary><code>example questions</code></summary>

* Survival Kaplan-Meier curve
* Survival Kaplan-Meier curves stratified by clinical variable

</details>

### Input columns

<details>

<summary><code>input columns</code></summary>

| column       | type             | required | description                                                                           |
| ------------ | ---------------- | -------- | ------------------------------------------------------------------------------------- |
| index        | any              | required | Patient identifier — one row per patient.                                             |
| time         | numeric          | required | Survival duration (numeric). Input is assumed to be in years unless stated otherwise. |
| event        | boolean, numeric | required | Event indicator (boolean or 0/1; True/1 = event occurred, False/0 = censored).        |
| color\_group | categorical      | optional | Stratification variable — each unique value produces a separate survival curve.       |
| patient\_id  | categorical      | required | Patient identifier required for population summary statistics.                        |

</details>

### Visualizations

* `kaplan_meier` How to read: One step curve per group (a single curve when the data is unstratified): each step down is one or more events, and the flatter the curve the longer the cohort stays event-free. Shaded bands around each curve are 95% confidence intervals — overlapping bands signal uncertainty, not necessarily significance; significance comes from the accompanying statistical table, whose stars mark group pairs with FDR-adjusted p<0.05 (★ p<0.05, ★★ p<0.01, ★★★ p<0.001, ★★★★ p<0.0001) and which names the group with the longer survival per pair. The y-axis is the probability of remaining event-free (labelled with the outcome, e.g. Overall Survival); the x-axis is time since baseline, in the chosen unit. Hovering a curve shows its survival probability and the number of patients still at risk at that time.

### Example analysis 1

#### Name — Progression-Free Survival by Lymphocyte Density in Tumor (Age > 40)

#### Analysis parameters

<details>

<summary><code>analysis_name, analysis_params, viz_params</code></summary>

```json
{
  "analysis_name": "kaplan_meier_analysis",
  "analysis_params": {
    "time_unit": "years",
    "max_time": null
  },
  "viz_params": {
    "plot_name": "kaplan_meier",
    "outcome_label": "Progression-Free Survival",
    "group_label": "Lymphocyte Density in Tumor",
    "show_ci": true,
    "title": "Progression-Free Survival by Lymphocyte Density in Tumor (Age > 40)"
  }
}
```

</details>

#### Visualization — `kaplan_meier`

![Progression-Free Survival by Lymphocyte Density in Tumor (Age > 40)](https://1034377358-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTmCjUj6W0sltjW7q2vBp%2Fuploads%2Fgit-blob-42cc0e0889923cfa8d401a72bf20117a45a6aa96%2Fkaplan_meier_analysis__kaplan_meier__kaplan_meier.png?alt=media)

#### Output table

<details>

<summary><code>descriptive_stats</code> (4 rows)</summary>

| group   | n   | n\_events | n\_censored | km\_median | km\_median\_ci\_lower | km\_median\_ci\_upper | q10   | q25   | q50   | q75    | q90    |
| ------- | --- | --------- | ----------- | ---------- | --------------------- | --------------------- | ----- | ----- | ----- | ------ | ------ |
| High    | 125 | 61        | 64          | 2.491      | 1.399                 | 4.939                 |       |       | 2.491 | 0.8925 | 0.46   |
| Low     | 118 | 65        | 53          | 1.676      | 1.191                 | 2.338                 | 8.449 | 6.768 | 1.676 | 0.6023 | 0.3641 |
| Medium  | 113 | 74        | 39          | 1.52       | 1.076                 | 1.821                 |       | 3.888 | 1.52  | 0.6461 | 0.2683 |
| Overall | 356 | 200       | 156         | 1.722      | 1.467                 | 2.075                 |       | 8.088 | 1.722 | 0.7118 | 0.3669 |

</details>

<details>

<summary><code>statistical_tests</code> (4 rows)</summary>

| Contrast       | Test used for pairwise comparison | Statistic | coef    | Higher Survival Group | P-value | Adjusted P-value | Significance level |
| -------------- | --------------------------------- | --------- | ------- | --------------------- | ------- | ---------------- | ------------------ |
| (global)       | cox\_hr                           |           |         |                       | 0.06296 | 0.06296          |                    |
| (High, Medium) | cox\_hr                           | 2.263     | 0.392   | High                  | 0.02366 | 0.07099          |                    |
| (High, Low)    | cox\_hr                           | 1.706     | 0.3048  | High                  | 0.08795 | 0.1319           |                    |
| (Low, Medium)  | cox\_hr                           | 0.4772    | 0.08128 | Low                   | 0.6332  | 0.6332           |                    |

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.owkin.com/explore-and-analyse-data/data-analysis/survival-outcomes/kaplan-meier-survival-curves.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
