Description Usage Arguments Details Value Author(s) References Examples

This function provides nonparametric estimates in progressive multi-state models with three states (illness-death model and three-state model). Fits also semi-parametric Cox models in a multi-state framework (one for each transition).

1 |

`data` |
The input data. A data.frame in which to interpret the variables named in the covariates. A data frame with at least 5 variables: times1 (time of the intermediate event/censoring time), delta (indicator of transition tothe intermediate event), times2 (time to the final event/censoring time), time (times1 + times2) and status (censoring indicator: "dead"=1, "alive"=0). The remaining variables in the data.frame are left for the covariates. |

`coxdata` |
Data set in a counting process data-structure. This data set can be obtained using data.creation.reg. If NULL the main function p3state will automatically create this dataset every time is called. |

`formula` |
A formula giving the vector of covariates. For example |

`regression` |
A logical variable indicating whether you want the regression model. |

Multi-state models may be considered a generalization of survival analysis where survival is the ultimate outcome of interest but where intermediate (transient) states are identified. The influence of the intermediate events on survival may be investigated through the effect of the time-dependent covariate (using the Cox regression model with time-dependent covariates; TDCM). However, these covariates can also be re-expressed as a multi-state model with states based on the values of the covariate (typically coded as 1=yes; 0=no). If all subjects observe the intermediate event then the time-dependent covariate makes it possible to use the progressive three-state model. Otherwise makes it feasible to use an illness-death model. In these models issues, of interest include the estimation of transition probabilities and assessing the effects of individual risk factors.

Returns a list of the following items:

`descriptives` |
vector with observed transitions between states |

`datafr ` |
data.frame to be used for obtaining the nonparametric estimates and for plotting purposes |

`tdcm ` |
coxph object with the fit of the Cox regression model with time-dependent covariates |

`msm12 ` |
coxph object with the fit of the Cox model for transition from state 1 to state 2 |

`msm13 ` |
coxph object with the fit of the Cox model for transition from state 1 to state 3 (only for the progressive three-state model) |

`cmm23 ` |
coxph object with the fit of the Cox Markov model for transition from state 2 to state 3 |

`tma ` |
coxph object with the fit of a Cox model for testing the Markov assumption |

Luis Meira-Machado and Javier Roca-Pardinas

Meira-Machado L, De Una-Alvarez J, Cadarso-Suarez C (2006). "Nonparametric estimation of transition probabilities in a non-Markov illness-death model." Lifetime Data Analysis, 12, 325-344.

de Una-Alvarez J, Meira-Machado LF (2008). A simple estimator of the bivariate distribution function for censored gap times. Statistics & Probability Letters, 78: 2440-2445.

Meira-Machado l, Roca-Pardinas J (2011). "p3state.msm: Analyzing Survival Data from an Illness-Death Model." Journal of Statistical Software, 38(3): 1-18.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
data(heart2)
res.p3state<-p3state(heart2,formula=~age+year+surgery)
summary(res.p3state)
##Only regression
summary(res.p3state,model="TDCM")
summary(res.p3state,model="CMM")
##without regression
summary(res.p3state,time1=20,time2=200)
##Both
summary(res.p3state,estimate=TRUE,time1=20,time2=200,model="CMM")
##Just for illustration purposes we create a new subset by restricting
##the original data set from those subjects experiencing the transplant
## (progressive three-state model)
p<-which((heart2$delta==0 & heart2$status==0) | heart2$delta==1)
exampledata<-heart2[p,]
res2.p3state<-p3state(exampledata)
summary(res2.p3state)
``` |

```
Loading required package: survival
Illness-death model
Number of individuals experiencing the intermediate event: 69
Number of events for the direct transition from state 1 to state 3: 30
Number of individuals remaining in state 1: 4
Number of events on transition from state 2: 45
Number of censored observations on transition from state 2: 24
Illness-death model
Number of individuals experiencing the intermediate event: 69
Number of events for the direct transition from state 1 to state 3: 30
Number of individuals remaining in state 1: 4
Number of events on transition from state 2: 45
Number of censored observations on transition from state 2: 24
***** TIME-DEPENDENT COX REGRESSION MODEL *****
n= 172
coef exp(coef) se(coef) z Pr(>|z|)
age 0.02716664 1.0275390 0.01371412 1.98092553 0.04759963
year -0.14634635 0.8638585 0.07046798 -2.07677794 0.03782206
surgery -0.63720989 0.5287657 0.36722600 -1.73519821 0.08270570
treat -0.01025077 0.9898016 0.31375480 -0.03267128 0.97393672
exp(coef) exp(-coef) lower .95 upper .95
age 1.0275390 0.9731991 1.0002875 1.0555330
year 0.8638585 1.1575970 0.7524197 0.9918021
surgery 0.5287657 1.8911969 0.2574423 1.0860419
treat 0.9898016 1.0103035 0.5351550 1.8306980
Likelihood ratio test= 15.11148 on 4 df, p= 0.0044755
-2*Log-likelihood= 581.1312
Illness-death model
Number of individuals experiencing the intermediate event: 69
Number of events for the direct transition from state 1 to state 3: 30
Number of individuals remaining in state 1: 4
Number of events on transition from state 2: 45
Number of censored observations on transition from state 2: 24
*********************** COX MARKOV MODEL ***********************
*************** FROM STATE 1 TO STATE 3 ****************
n= 103
coef exp(coef) se(coef) z Pr(>|z|)
age 0.01978539 1.0199824 0.01807908 1.0943806 0.27378810
year -0.28331015 0.7532861 0.11096315 -2.5531913 0.01067409
surgery -0.22875449 0.7955238 0.63608541 -0.3596286 0.71912491
exp(coef) exp(-coef) lower .95 upper .95
age 1.0199824 0.9804091 0.9844729 1.0567728
year 0.7532861 1.3275168 0.6060493 0.9362934
surgery 0.7955238 1.2570334 0.2286737 2.7675156
Likelihood ratio test= 8.623363 on 3 df, p= 0.03474115
-2*Log-likelihood= 214.9848
*************** FROM STATE 1 TO STATE 2 ****************
n= 103
coef exp(coef) se(coef) z Pr(>|z|)
age 0.0311147186 1.031604 0.01398119 2.22546929 0.02604975
year 0.0007505999 1.000751 0.06948591 0.01080219 0.99138127
surgery 0.0473360792 1.048474 0.31524102 0.15015838 0.88063966
exp(coef) exp(-coef) lower .95 upper .95
age 1.031604 0.9693644 1.0037190 1.060263
year 1.000751 0.9992497 0.8733322 1.146760
surgery 1.048474 0.9537668 0.5652286 1.944874
Likelihood ratio test= 5.768582 on 3 df, p= 0.1234284
-2*Log-likelihood= 509.5638
*************** FROM STATE 2 TO STATE 3 ****************
n= 69
coef exp(coef) se(coef) z Pr(>|z|)
age 0.04956295 1.0508117 0.02137741 2.3184737 0.02042359
year -0.02303487 0.9772284 0.09693819 -0.2376243 0.81217248
surgery -0.81647952 0.4419849 0.45491690 -1.7947883 0.07268744
exp(coef) exp(-coef) lower .95 upper .95
age 1.0508117 0.9516452 1.0076935 1.095775
year 0.9772284 1.0233022 0.8081317 1.181708
surgery 0.4419849 2.2625206 0.1812097 1.078036
Likelihood ratio test= 11.30435 on 3 df, p= 0.01018901
-2*Log-likelihood= 290.1922
Checking the Markov assumption:
Testing if the time spent in state 1 (start) is important on transition from state 2 to state 3
coef exp(coef) se(coef) z Pr(>|z|)
start -0.009392569 0.9906514 0.005340591 -1.758713 0.07862619
The p-value is 0.07862619
Illness-death model
Number of individuals experiencing the intermediate event: 69
Number of events for the direct transition from state 1 to state 3: 30
Number of individuals remaining in state 1: 4
Number of events on transition from state 2: 45
Number of censored observations on transition from state 2: 24
The estimate of the transition probability P11( 20 , 200 ) is 0.1040599
The estimate of the transition probability P12( 20 , 200 ) is 0.4771075
The estimate of the transition probability P13( 20 , 200 ) is 0.4188325
The estimate of the transition probability P22( 20 , 200 ) is 0.3543908
The estimate of the transition probability P23( 20 , 200 ) is 0.6456092
Illness-death model
Number of individuals experiencing the intermediate event: 69
Number of events for the direct transition from state 1 to state 3: 30
Number of individuals remaining in state 1: 4
Number of events on transition from state 2: 45
Number of censored observations on transition from state 2: 24
The estimate of the transition probability P11( 20 , 200 ) is 0.1040599
The estimate of the transition probability P12( 20 , 200 ) is 0.4771075
The estimate of the transition probability P13( 20 , 200 ) is 0.4188325
The estimate of the transition probability P22( 20 , 200 ) is 0.3543908
The estimate of the transition probability P23( 20 , 200 ) is 0.6456092
*********************** COX MARKOV MODEL ***********************
*************** FROM STATE 1 TO STATE 3 ****************
n= 103
coef exp(coef) se(coef) z Pr(>|z|)
age 0.01978539 1.0199824 0.01807908 1.0943806 0.27378810
year -0.28331015 0.7532861 0.11096315 -2.5531913 0.01067409
surgery -0.22875449 0.7955238 0.63608541 -0.3596286 0.71912491
exp(coef) exp(-coef) lower .95 upper .95
age 1.0199824 0.9804091 0.9844729 1.0567728
year 0.7532861 1.3275168 0.6060493 0.9362934
surgery 0.7955238 1.2570334 0.2286737 2.7675156
Likelihood ratio test= 8.623363 on 3 df, p= 0.03474115
-2*Log-likelihood= 214.9848
*************** FROM STATE 1 TO STATE 2 ****************
n= 103
coef exp(coef) se(coef) z Pr(>|z|)
age 0.0311147186 1.031604 0.01398119 2.22546929 0.02604975
year 0.0007505999 1.000751 0.06948591 0.01080219 0.99138127
surgery 0.0473360792 1.048474 0.31524102 0.15015838 0.88063966
exp(coef) exp(-coef) lower .95 upper .95
age 1.031604 0.9693644 1.0037190 1.060263
year 1.000751 0.9992497 0.8733322 1.146760
surgery 1.048474 0.9537668 0.5652286 1.944874
Likelihood ratio test= 5.768582 on 3 df, p= 0.1234284
-2*Log-likelihood= 509.5638
*************** FROM STATE 2 TO STATE 3 ****************
n= 69
coef exp(coef) se(coef) z Pr(>|z|)
age 0.04956295 1.0508117 0.02137741 2.3184737 0.02042359
year -0.02303487 0.9772284 0.09693819 -0.2376243 0.81217248
surgery -0.81647952 0.4419849 0.45491690 -1.7947883 0.07268744
exp(coef) exp(-coef) lower .95 upper .95
age 1.0508117 0.9516452 1.0076935 1.095775
year 0.9772284 1.0233022 0.8081317 1.181708
surgery 0.4419849 2.2625206 0.1812097 1.078036
Likelihood ratio test= 11.30435 on 3 df, p= 0.01018901
-2*Log-likelihood= 290.1922
Checking the Markov assumption:
Testing if the time spent in state 1 (start) is important on transition from state 2 to state 3
coef exp(coef) se(coef) z Pr(>|z|)
start -0.009392569 0.9906514 0.005340591 -1.758713 0.07862619
The p-value is 0.07862619
Progressive three-state model
Number of individuals experiencing the intermediate event: 69
Number of events for the direct transition from state 1 to state 3: 0
Number of individuals remaining in state 1: 4
Number of events on transition from state 2: 45
Number of censored observations on transition from state 2: 24
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.