Code covered by the BSD License  

Highlights from
Kaplan Meier for right and/or left and/or interval censored data

  • KM.m
  • example.mWe consider the data set: "Time to first use of marijuana" (presented in Klein and Moeschberger (2003), section 1.17)
  • View all files
Be the first to rate this file! 12 Downloads (last 30 days) File Size: 3.79 KB File ID: #41325

Kaplan Meier for right and/or left and/or interval censored data

by

 

Provides the Product Limit Estimator (Kaplan Meier) for left/right/interval censored data through R

| Watch this File

File Information
Description

% INPUT ARGUMENTS:
% times: An n by 2 matrix which refer to the time data. The two columns
% define the interval in which the event occured. If in one row the two
% "times" elements are equal then this corresponds to an event time. If the
% left column time point is finite and the right column time point is Inf
% then we have right censoring. If the left time point is -Inf and the
% right time point is finite then we have left censoring. For example:
%
%
% 5 Inf -> right censored observation
% -Inf 8 -> left censored observation
% 8 11 -> interval censoring
% 9 9 -> fully (exactly) observed
%
% Note that, since negative time values are also allowed, for left censored
% values you need to specify the left limit as -Inf. To be clear, Infs and
% -Infs are replaced as "NA" in the corresponding survfit R function.
%
%OUTPUT ARGUMENTS:
%time: the time points for which the survival is evaluated
%S : the survival estimate
%SE : the standard error of the estimate
%L : the lower limit of the corresponding 95% confidence interval for the
% survival
%U : the upper limit of the corresponding 95% confidence interval for the
% survival
%
%see also the example file.
%
%If only right censoring is present then the usual Kaplan Meier is employed
%and there is no need to use this code since MATLAB has already the built
%in function "ecdf" which will be faster. If left/interval censoring is
%present the Turnbull algorithm is employed. This algorithm is also
%described in detail in:
%
%"Klein and Moeschberger (2003), Survival Analysis (Techniques for censored
%and truncated data), Springer-Verlag, New York."
%
%This program does nothing more than calling the corresponding R functions.
%It is necessary to download MATLAB R-link and follow all instructions
%described therein:
%
%http://www.mathworks.com/matlabcentral/fileexchange/5051-matlab-r-link
%
%This means that you also have to download and install Randfriends:
%
%http://rcom.univie.ac.at/download.html
%
%This works for both 32bit and 64bit machines.
%Please try to also run the demo included in the MATLAB R-link package, and
%make sure that everything works before trying this code.
%After that, you must download and install the packages "survival"
%and "matlab" in R. The analysis provided by this code is in fact the
%output as provided by the corresponding survival package (survfit)
%provided by prof. Terry Therneau.
%
%
%
%References:
%
%Turnbull, B. W. Nonparametric Estimation of a Survivorship Function with Doubly
%Censored Data. Journal of the American Statistical Association 69 (1974): 169–173.
%
%Turnbull, B. W. The Empirical Distribution Function with Arbitrarily Grouped, Censored
%and Truncated Data. Journal of the Royal Statistical Society B 38 (1976): 290–295.
%
%Klein and Moeschberger (2003), Survival Analysis (Techniques for censored
%and truncated data), Springer-Verlag, New York."
%
%R survival package by Terry Therneau. see also:
%http://cran.r-project.org/web/packages/survival/survival.pdf
%
%

Acknowledgements

Matlab R Link inspired this file.

MATLAB release MATLAB 7.10 (R2010a)
Other requirements Randfriends, R "survival" package, R "matlab" package (see description).
Tags for This File   Please login to tag files.
Please login to add a comment or rating.

Contact us