The purpose of the present vignette is to demonstrate the capacities
of the R package *markovMSM*, as a tool to check the Markov
condition. To this end, in the folowing example, we use data from a
study with liver cirrhosis patients subjected to prednisone treatment
(Andersen et al., 1993).

The proposed methods can also be used in reversible multi-state models such as those applied to the data set of liver cirrhosis patients who were included in a randomized clinical trial at several hospitals in Copenhagen between 1962 and 1974. The study aimed to evaluate whether a treatment based on prednisone prolongs survival for patients with cirrhosis Andersen et al. (1993). State 1 corresponds to ‘normal prothrombin level’, State 2 to ‘low (or abnormal) prothrombin level’, and State 3 to ‘dead’. The movement of the patients among these three states can be modeled using the reversible illness-death model shown in the next figure.

Note that the original data set prothr is already in the long format. Thus to obtain the probability values for transitions from State 2, the input command is the following:

```
library(markovMSM)
data("prothr")
set.seed(1234)
<- AUC.test(data = prothr, from=2, to=3, type='global', replicas=2,
res8 limit=0.90, quantiles=c(.05, .10, .20, .30, 0.40))
#> Computation involving the first (of five) percentile times: done! || Execution time since the beginning: 0.05954918 mins
second (of five) percentile times: done! || Execution time since the beginning: 0.1504327 mins
Computation involving the third (of five) percentile times: done! || Execution time since the beginning: 0.2268116 mins
Computation involving the fourth (of five) percentile times: done! || Execution time since the beginning: 0.2962775 mins
Computation involving the fifth (of five) percentile times: done! || Execution time since the beginning: 0.3613444 mins
Computation involving the
round(res8$globalTest,5)
#> 2->1 2->2 2->3
#> 1 0 0 0
round(res8$localTests,4)
#> s 2->1 2->2 2->3
#> 1 73.5 0.000 0.000 0.1542
#> 2 117.0 0.000 0.001 0.1336
#> 3 223.0 0.000 0.000 0.0000
#> 4 392.0 0.000 0.000 0.0000
#> 5 681.0 0.024 0.000 0.3727
```

Below we report, for the same data set prothr, the results for global and local tests proposed by Titman and Putter (2020), which are based on log-rank statistics, for transition 4 (between the states 2 and 3) and transition 3, (between the states 2 and 1), with times corresponding to the percentiles 5, 10, 20, 30, and 40 (the default percentile values also used by the AUC global test). The corresponding input commands are the following:

```
set.seed(1234)
<- c(73.5, 117, 223, 392, 681)
times
<- LR.test(data=prothr, times=times, from = 2, to = 3, replicas = 10)
res9
$localTestLR
res9#> [1] 0.907 0.330 0.758 0.516 0.193
$globalTestLR
res9#> [1] 0.4
set.seed(1234)
<- LR.test(data=prothr, times=times, from = 2, to = 1, replicas = 10)
res10
$localTestLR
res10#> [1] 0.012 0.007 0.107 0.044 0.500
$globalTestLR
res10#> [1] 0
```

Soutinho G., Meira-Machado L.

*Methods for checking the Markov condition in multi-state survival data*, Computational Statistics, 2021.de Una-alvarez J., Meira-Machado L.

*Nonparametric estimation of transition probabilities in the non-Markov illness-death model: A comparative study*, Biometrics, 71(2), 364-375, 2015.Putter H., Spitoni C.

*Non-parametric estimation of transition probabilities in non-Markov multi-state models: The landmark Aalen-Johansen estimator*, Statistical Methods in Medical Research, 27, 2081-2092, 2018.Meira-Machado L., Sestelo M.

*Estimation in the progressive illness-death model: A nonexhaustive review*, Biometrical Journal, 61(2), 245-263, 2019Titman A.C., Putter H.

*General tests of the Markov property in multi-state models*, Biostatistics, 2020