markovMSM: An R Package for Checking the Markov Condition in Multi-State Survival Data

Multi-state models can be used to describe processes in which an individual moves through a finite number of states in continuous time. These models allow a detailed view of the evolution or recovery of the process and can be used to study the effect of a vector of explanatory variables on the transition intensities or to obtain prediction probabilities of future events after a given event history. In both cases, before using these models, we have to evaluate whether the Markov assumption is tenable. This paper introduces the markovMSM package, a software application for R, which considers tests of the Markov assumption that are applicable to general multi-state models. Three approaches using existing methodology are considered: a simple method based on including covariates depending on the history; methods based on measuring the discrepancy of the non-Markov estimators of the transition probabilities to the Markovian Aalen-Johansen estimators; and, finally, methods that were developed by considering summaries from families of log-rank statistics where individuals are grouped by the state occupied by the process at a particular time point. The main functionalities of the markovMSM package are illustrated using real data examples.

Gustavo Soutinho (EPIUnit, Institute of Public Health of the University of Porto (ISPUP)) , Luís Meira-Machado (Department of Mathematics & Centre of Mathematics, University of Minho)

Supplementary materials

Supplementary materials are available in addition to this article. It can be downloaded at



Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Soutinho & Meira-Machado, "markovMSM: An R Package for Checking the Markov Condition in Multi-State Survival Data", The R Journal, 2023

BibTeX citation

  author = {Soutinho, Gustavo and Meira-Machado, Luís},
  title = {markovMSM: An R Package for Checking the Markov Condition in Multi-State Survival Data},
  journal = {The R Journal},
  year = {2023},
  note = {},
  doi = {10.32614/RJ-2023-032},
  volume = {15},
  issue = {1},
  issn = {2073-4859},
  pages = {195-211}