View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

4.8 | 4 ratings Rate this file 26 Downloads (last 30 days) File Size: 4.68 KB File ID: #22293 Version: 1.8
image thumbnail




02 Dec 2008 (Updated )

Plot the Kaplan-Meier estimation of the survival function

| Watch this File

File Information

Survival times are data that measure follow-up time from a defined starting point to the occurrence of a given event, for example the time from the beginning to the end of a remission period or the time from the diagnosis of a disease to death. Standard statistical techniques cannot usually be applied because the underlying distribution is rarely Normal and the data are often ‘censored’. A survival time is described as censored when there is a follow-up time but the event has not yet occurred or is not known to have occurred. For example, if remission time is being studied and the patient is still in remission at the end of the study, then that patient’s remission time would be censored. If a patient for some reason drops out of a study before the end of the study period, then that patient’s follow-up time would also be considered to be
censored. The survival function S(t) is defined as the probability of surviving at least to time t. The graph of S(t) against t is called the survival curve. The Kaplan–Meier method can be used to estimate this curve from the observed survival times without the assumption of an underlying probability distribution. This function uses the vectorization technique.

My profile on LinkedIN

Required Products Statistics and Machine Learning Toolbox
MATLAB release MATLAB 7.6 (R2008a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
24 Nov 2016 Xiaoya Li

19 Dec 2012 Elaine Fang

29 Aug 2012 Jiao

Jiao (view profile)

Sometimes this function fails to plot the survival curve reporting such error: "CAT arguments dimensions are not consistent." "Error in ==> kmplot at 240 str2=['Median time ' num2str(mt)]; %string for LEGEND function".

29 Mar 2012 Giuseppe Cardillo

usually you dont exaclty know when a subject really is censored (in example: a patient died between to follow-up points or a patient that decided to not present himself to follow-up). So the best "graphical" choice is to divide the space between to points in to N+1 segments (where N is the censored data between T1 and T2) and to plot a cross for each segments.

Comment only
29 Mar 2012 Johannes Sarnthein

I noticed that the time of censoring is not plotted correctly. I could not fix it. Could you maybe help?

Comment only
09 Mar 2012 Johannes Sarnthein

serves the purpose - thanks a lot!

03 Dec 2008 1.1

help section change to correctly cite this file; median time computation was changed (in some cases there is not median time)

04 Dec 2008 1.2

The function was adapted to be recalled by LOGRANK function (a function of mine). More vectorization.

08 Jun 2009 1.3

error correction in confidence curve trimming

27 Jul 2009 1.4

improvement for censored data

23 Dec 2009 1.5

Changes in description

22 Sep 2011 1.6

Hazard rate computation added

06 Apr 2012 1.7

function for hazard rate computation was changed to avoid NaN in non linear fit.
Now is possible to choose how to plot censored data: if spreades along period or at period of observation.

10 May 2012 1.8

fixed a bug into "input error handling" section

Contact us