# Kaplan-Meier Survival Curve

{% hint style="info" %}
An Apollo license is required to use Cohort Browser on the DNAnexus Platform. Org approval may also be required. [Contact DNAnexus Sales](mailto:sales@dnanexus.com) for more information.
{% endhint %}

## Building a Kaplan-Meier Survival Curve Chart

To generate a survival chart, select one numerical field representing time, and one categorical field, which is transformed into the individual's status.

The categorical field should use one of the following 4 terms (case-insensitive) to indicate a status of "Living": `living`, `alive`, `diseasefree`, `disease-free`.

For multi-entity datasets, survival curve charts only support data fields from the main entity, or entities with a 1:1 relation to the main entity.

## Calculating Survival Percentage

To calculate survival percent at the current event the system evaluates the following formula:

$$S\_T = \frac{L\_{T0} - D}{L\_{T0}}$$

* $$S\_T$$: Survival at the current event
* $$L\_{T0}$$: Number of subjects living at the start of the period or event
* $$D$$: Number of subjects that died

For each time period the following values are generated:

* **Status**: Each individual is considered *Dead* unless they qualify as *Living*.
* **Number of Subjects Living at the Start** ($$L\_{T0}$$)
  * For the initial value this is the total number of records returned by the backend from survival data with *Living* or *Dead* Status.
  * For followup events this is the number of subjects at the start of the previous event minus the number of subjects that died in the previous event and the subjects that dropped out or were censored in the previous event.
* **Number of Subjects Who Died** ($$D$$): 1 for each individual who at the event does not have a status of *Living*.
* **Number of Subjects Dropped or Censored**: 1 for each individual who at the event has a status of *Living*.
* **Survival Percent at the Current Event** ($$S\_T$$): $$S\_T = \frac{L\_{T0} - D}{L\_{T0}}$$
* **Cumulative Survival** ($$S$$): $$S = S\_{T-1} \cdot S\_T$$ where $$S\_{T-1}$$ is the survival percent at the previous event.

This is the actual point drawn on the survival plot.

## Learn More

* [Survival Curve Wikipedia](https://en.wikipedia.org/wiki/Survival_function)
* [Kaplan-Meier Wikipedia](https://en.wikipedia.org/wiki/Kaplan%E2%80%93Meier_estimator)


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.dnanexus.com/user/cohort-browser/chart-types/survival-plot-tile.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
