While the Cox model with time-dependent covariates (TDCM) can be fitted through all the major statistical packages, MSMs need specialised software, most of which are written in FORTRAN, R or SAS. In the nineties, Marshall et al
developed a FORTRAN program called MARKOV
, for fitting general k
-state Markov models (with k
− 1 transient states and where the k
th state can be optionally chosen as an absorbing state) with constant transition intensities and covariates. Later, Alioum and Commenges37
presented a new computer program, called MKVPCI
, which extends MARKOV
by allowing piecewise-constant intensities with different values in at most three time intervals. This method needs prior specification of the cutpoints. The output of this software includes estimates of the baseline transition hazards, regression parameter estimates, transition intensities in time intervals together with their estimated standard errors, and the results of the multivariate hypothesis tests. However, it does not supply graphical output.
developed the R package msm
, implementing several functions for fitting continuous-time Markov and hidden Markov multi-state models (a model in which the stages are observed with misclassification) to longitudinal data. Covariates can be fitted to both the transition rates and misclassification probabilities. A variety of observation schemes are supported, including processes observed at arbitrary times, completely-observed processes, and censored states. Any pattern of transitions between states can be specified. The msm
package provides several numerical outputs such as estimated coefficients (with confidence intervals), time spent in each state, the estimate of the ratio of two estimated transition intensities etc. Graphical output includes the survival plot and plot of the expected probability of survival against time (from each transient state). Tables of observed and expected prevalences (which can be used as a rough indication of the goodness of fit) can also be obtained.
Methods introduced by Therneau and Grambsch27
can also be used to model multi-state survival data. These methods are based on Cox's regression model and can be fitted using standard software (R, S-plus, SAS, etc.). The library survival
available as part of S-plus and R statistical packages can be used to implement these methods. The key here is the creation of an appropriate data set representing each individual by several observations. This approach can be done for Markov and semi-Markov models and can deal with any kind of process though it becomes complicated with the increase of the number of states. More details about this procedure will be given later in our applications. For recurrent events, these methods can also be fitted using an SAS macro, called PTRANSIT
, developed by Paes and Lima39
for Markov processes. This macro can also be used for estimating transition probabilities.
Hui-Min et al
developed a SAS macro for estimating the transition parameters in non-homogeneous (Weibull distributions, log-logistic, etc.) k
-state progressive Markov model with several covariates.
Rosthøj et al
developed two SAS macros for estimation of the transition probabilities for a CMM for competing risks survival data. A competing risks model with k
causes of failures is considered.
Recently, Wangler et al
developed a R library called changeLOS
that implements the Aalen–Johansen estimator for general multi-state models with non-parametric hazards. The main goal of changeLOS
is to compute the change in LOS (length of hospital stay), frequently used to assess the impact and the costs of hospital-acquired complication. So far, no covariates are included in this library.
Most of the existing software for MSMs presents, however, some difficulties and limitations in practice. Most of the available software assumes the process to be Markovian and/or time-homogeneous, and some of them are available as part of statistical packages which are not freely downloadable. Furthermore, possible comparisons between different multi-state models are rather difficult because each of the current programs requests its own data structure.
We, therefore, developed a user-friendly R library, that we called tdc.msm
, for the analysis of multi-state survival data. Specifically, the new software may be used to fit the TDCM but also the reviewed MSMs (THMM, NHM, CMM and CSMM). In the models considered, patients pass from the initial state through one of a set of mutually excusive states to an absorbing state. Advantages of this software include the same data input for fitting the different models while providing the corresponding numerical and graphical outputs obtained: parameter estimates with standard errors for the covariates; transition rates; survival estimates; transition probabilities estimates; and flexible p-spline hazard ratio estimates for continuous covariates.33
Moreover, users are able to include any number of covariates on transition intensities.
Our library allows users to choose between Markov (THMM, NHM, CMM) and semi-Markov models (CSMM), and between time-homogeneous (THMM) and non-homogeneous models. A homogeneous Markov model can be fitted using the msm
R package, a non-homogeneous piecewise model using MKVPCI
, or a CMM using PTRANSIT
, but our software puts them into the same library. In this way, users may easily analyse the results offered by the various models in order to compare them and make decisions accordingly. The tdc.msm
program can be downloaded free of charge from http://www.mct.uminho.pt/lmachado/Rlibrary. Technical description of this program is provided in the independent article Meira-Machado et al
Examples of analysis using this software will be shown in the following section using two data sets: the well-known Stanford heart transplant study data, and the Galician breast cancer data set.