A Kaplan-Meier curve is a descriptive (non-parametric) method that visualizes the survival function (or hazard function). The visual representation is based on the Kaplan-Meier estimator (also called product-limit estimator). On the y-axis, we get conditional probabilities, whereas time bands (time intervals) are displayed on the x-axis. The time bands can be based on any time unit, such as, hours, days, months, or years.
| Note Kaplan-Meier estimation is very similar to life-table methods. Primary differences lie in the methods for choosing time bands and handling ties. Similar to Cox regression, Kaplan-Meier estimation assumes that ties are rare, since time-to-event is measured on a continuous scale. |
Kaplan-Meier survivor function
We can generate a graph showing the Kaplan-Meier survivor function. This shows the probability of survival at each time band, calculated as the number of individuals surviving divided by the number of individuals at risk.
In the graph, we will include confidence intervals (ci option) and use the noorigin option to exclude the time before follow-up from the graph.
sts graph, survival ci noorigin |

The scale is a bit too wide – we do not really see the line properly. This can be fixed by specifying the y-axis (with the ylabel option). While we are at it, we can adjust the x-axis (with the xlabel option) as well.
sts graph, survival ci noorigin ylabel(.90(0.01)1) xlabel(40(1)51) |

Above, we have specified that the y-axis should range from 0.90 to 1, with one tick per 0.01 unit. And the x-axis ranges from 40 to 51, with one tick per 1 unit.
More informationhelp sts graph |
Kaplan-Meier failure function
We could also produce the opposite, namely a graph of the failure function:
sts graph, failure |

Again, we can change the specification to adapt the scale:
sts graph, failure ci noorigin ylabel(.10(0.01)0) xlabel(40(1)51) |

More informationhelp sts graph |