blob: 6ea6fbc50fbdfd829769bda9b376d6e40806cd57 [file] [log] [blame]
 \begin{comment} Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. \end{comment} \subsection{Kaplan-Meier Survival Analysis} \label{sec:kaplan-meier} \noindent{\bf Description} \smallskip Survival analysis examines the time needed for a particular event of interest to occur. In medical research, for example, the prototypical such event is the death of a patient but the methodology can be applied to other application areas, e.g., completing a task by an individual in a psychological experiment or the failure of electrical components in engineering. Kaplan-Meier or (product limit) method is a simple non-parametric approach for estimating survival probabilities from both censored and uncensored survival times.\\ \smallskip \noindent{\bf Usage} \smallskip {\hangindent=\parindent\noindent\it% {\tt{}-f }path/\/{\tt{}KM.dml} {\tt{} -nvargs} {\tt{} X=}path/file {\tt{} TE=}path/file {\tt{} GI=}path/file {\tt{} SI=}path/file {\tt{} O=}path/file {\tt{} M=}path/file {\tt{} T=}path/file {\tt{} alpha=}double {\tt{} etype=}greenwood$\mid$peto {\tt{} ctype=}plain$\mid$log$\mid$log-log {\tt{} ttype=}none$\mid$log-rank$\mid$wilcoxon {\tt{} fmt=}format } \smallskip \noindent{\bf Arguments} \begin{Description} \item[{\tt X}:] Location (on HDFS) to read the input matrix of the survival data containing: \begin{Itemize} \item timestamps, \item whether event occurred (1) or data is censored (0), \item a number of factors (i.e., categorical features) for grouping and/or stratifying \end{Itemize} \item[{\tt TE}:] Location (on HDFS) to read the 1-column matrix $TE$ that contains the column indices of the input matrix $X$ corresponding to timestamps (first entry) and event information (second entry) \item[{\tt GI}:] Location (on HDFS) to read the 1-column matrix $GI$ that contains the column indices of the input matrix $X$ corresponding to the factors (i.e., categorical features) to be used for grouping \item[{\tt SI}:] Location (on HDFS) to read the 1-column matrix $SI$ that contains the column indices of the input matrix $X$ corresponding to the factors (i.e., categorical features) to be used for grouping \item[{\tt O}:] Location (on HDFS) to write the matrix containing the results of the Kaplan-Meier analysis $KM$ \item[{\tt M}:] Location (on HDFS) to write Matrix $M$ containing the following statistics: total number of events, median and its confidence intervals; if survival data for multiple groups and strata are provided each row of $M$ contains the above statistics per group and stratum. \item[{\tt T}:] If survival data from multiple groups is available and {\tt ttype=log-rank} or {\tt ttype=wilcoxon}, location (on HDFS) to write the two matrices that contains the result of the (stratified) test for comparing these groups; see below for details. \item[{\tt alpha}:](default:\mbox{ }{\tt 0.05}) Parameter to compute $100(1-\alpha)\%$ confidence intervals for the survivor function and its median \item[{\tt etype}:](default:\mbox{ }{\tt "greenwood"}) Parameter to specify the error type according to "greenwood" or "peto" \item[{\tt ctype}:](default:\mbox{ }{\tt "log"}) Parameter to modify the confidence interval; "plain" keeps the lower and upper bound of the confidence interval unmodified, "log" corresponds to logistic transformation and "log-log" corresponds to the complementary log-log transformation \item[{\tt ttype}:](default:\mbox{ }{\tt "none"}) If survival data for multiple groups is available specifies which test to perform for comparing survival data across multiple groups: "none", "log-rank" or "wilcoxon" test \item[{\tt fmt}:] (default:\mbox{ }{\tt "text"}) Matrix file output format, such as {\tt text}, {\tt mm}, or {\tt csv}; see read/write functions in SystemML Language Reference for details. \end{Description} \noindent{\bf Details} \smallskip The Kaplan-Meier estimate is a non-parametric maximum likelihood estimate (MLE) of the survival function $S(t)$, i.e., the probability of survival from the time origin to a given future time. As an illustration suppose that there are $n$ individuals with observed survival times $t_1,t_2,\ldots t_n$ out of which there are $r\leq n$ distinct death times $t_{(1)}\leq t_{(2)}\leq t_{(r)}$---since some of the observations may be censored, in the sense that the end-point of interest has not been observed for those individuals, and there may be more than one individual with the same survival time. Let $S(t_j)$ denote the probability of survival until time $t_j$, $d_j$ be the number of events at time $t_j$, and $n_j$ denote the number of individual at risk (i.e., those who die at time $t_j$ or later). Assuming that the events occur independently, in Kaplan-Meier method the probability of surviving from $t_j$ to $t_{j+1}$ is estimated from $S(t_j)$ and given by \begin{equation*} \hat{S}(t) = \prod_{j=1}^{k} \left( \frac{n_j-d_j}{n_j} \right), \end{equation*} for \$t_k\leq t