| Title: | Analyzing Survival Data from an Illness-Death Model |
|---|---|
| Description: | Contains functions for data preparation, prediction of transition probabilities, estimating semi-parametric regression models and for implementing nonparametric estimators for other quantities. See Meira-Machado and Roca-Pardiñas (2011) <doi:10.18637/jss.v038.i03>. |
| Authors: | Luis Meira-Machado [aut] (ORCID: <https://orcid.org/0000-0002-8577-7665>), Javier Roca-Pardinas [aut] (ORCID: <https://orcid.org/0000-0003-3107-4515>), Artur Araujo [ctb] (ORCID: <https://orcid.org/0000-0003-1419-4208>), Gustavo Soutinho [ctb, cre] (ORCID: <https://orcid.org/0000-0002-0559-1327>) |
| Maintainer: | Gustavo Soutinho <[email protected]> |
| License: | GPL-3 |
| Version: | 1.3.3 |
| Built: | 2026-05-21 07:22:03 UTC |
| Source: | https://github.com/cran/p3state.msm |
p3state.msm provides functions for estimating semi-parametric regression models but also to implement nonparametric estimators for the transition probabilities. The methods can also be used in progressive three-state models. In progressive three-state models, estimators for other quantities such as the bivariate distribution function (for the sequentially ordered events) are also given.
| Package: | p3state.msm |
| Type: | Package |
| Version: | 1.3.2 |
| Date: | 2023-01-19 |
| License: | GPL-3 |
| LazyLoad: | yes |
| LazyData: | yes |
Luis Meira-Machado, Javier Roca Pardinas [email protected]
and Artur Araújo [email protected]
Maintainer: Luis Meira-Machado [email protected]
Crowley J., Hu M. (1977). Covariance analysis of heart transplant survival data. Journal of the American Statistical Association, 72(357), 27-36. doi:10.2307/2286902
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(3), 325-344. doi:10.1007/s10985-006-9009-x
de Una-Alvarez J., Meira-Machado L. (2008). A simple estimator of the bivariate distribution function for censored gap times. Statistics & Probability Letters, 78(15), 2440-2445. doi:10.1016/j.spl.2008.02.031
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. doi:10.18637/jss.v038.i03
Computation of the bivariate distribution function.
Biv(object, time1, time2)Biv(object, time1, time2)
object |
Component datafr of an object of class p3state. |
time1 |
The first time for obtaining estimates for the transition probabilities, bivariate distribution function. NULL is equivalent to 0. |
time2 |
The second time for obtaining estimates for the bivariate distribution function. |
Returns a single value.
Luis Meira-Machado, Javier Roca-Pardinas and Artur Araújo
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. doi:10.18637/jss.v038.i03
data(heart2) res.p3state<-p3state(heart2) Biv(res.p3state,time1=30,time2=300)data(heart2) res.p3state<-p3state(heart2) Biv(res.p3state,time1=30,time2=300)
Returns the input data in a different format. Provides the adequate dataset for implementing regression models.
data.creation.reg(data)data.creation.reg(data)
data |
A data.frame with at least 5 variables: times1 (time of the intermediate event/censoring time), delta (indicator of transition to the 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. |
A data.frame in a counting process format.
Luis Meira-Machado, Javier Roca-Pardinas and Artur Araújo
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. doi:10.18637/jss.v038.i03
This contains the Stanford heart transplant data in a different format.
The main data set is in (heart).
Survival of patients on the waiting list for the Stanford heart transplant program.
data(heart2)data(heart2)
A data frame with 103 observations on the following 8 variables.
times1Time of transplant/censoring time.
deltaTransplant indicator.
times2Time to death since the transplant/censoring time.
timetimes1 + times2
statusCensoring indicator: dead=1, alive=0.
ageAge-48 years.
yearYear of acceptance; in years after 1 Nov 1967.
surgeryPrior bypass surgery; 1=yes.
Crowley J., Hu M. (1977). Covariance analysis of heart transplant survival data. Journal of the American Statistical Association, 72(357), 27-36. doi:10.2307/2286902
This function provides nonparametric estimates in progressive multi-state models with three states (illness-death model and three-state model). Also fits semi-parametric Cox models in a multi-state framework (one for each transition).
p3state(data, coxdata=NULL, formula=NULL, regression=NULL)p3state(data, coxdata=NULL, formula=NULL, regression=NULL)
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 to the 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 |
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 |
Object of class ‘coxph’ with the fit of the Cox model with time-dependent covariates. |
msm12 |
Object of class ‘coxph’ with the fit of the Cox model for transition from state 1 to state 2. |
msm13 |
Object of class ‘coxph’ with the fit of the Cox model for transition from state 1 to state 3 (only for the progressive three-state model). |
cmm23 |
Object of class ‘coxph’ with the fit of the Cox Markov model for transition from state 2 to state 3. |
tma |
Object of class ‘coxph’ with the fit of a Cox model for testing the Markov assumption. |
Luis Meira-Machado, Javier Roca-Pardinas and Artur Araújo
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(3), 325-344. doi:10.1007/s10985-006-9009-x
de Una-Alvarez J., Meira-Machado L. (2008). A simple estimator of the bivariate distribution function for censored gap times. Statistics & Probability Letters, 78(15), 2440-2445. doi:10.1016/j.spl.2008.02.031
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. doi:10.18637/jss.v038.i03
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)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)
Computation of the transition probabilities.
pLIDA(object, time1, time2,tp=NULL)pLIDA(object, time1, time2,tp=NULL)
object |
Component datafr of an object of class p3state. |
time1 |
The first time for obtaining estimates for the transition probabilities, bivariate distribution function. NULL is equivalent to 0. |
time2 |
The second time for obtaining estimates for the bivariate distribution function. |
tp |
Optional argument: tp="all" (default value) to obtain all the transition probabilities p11, p12 and p22; tp="p11" to obtain only p11; tp="p12" to obtain only p12; tp="p22" to obtain only p22. |
Returns a single value if argument tp equals "p11", "p12", or "p22".
Returns a list if argument tp equals "all".
Luis Meira-Machado, Javier Roca-Pardinas and Artur Araújo
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. doi:10.18637/jss.v038.i03
data(heart2) res.p3state<-p3state(heart2) pLIDA(res.p3state,time1=30,time2=300)data(heart2) res.p3state<-p3state(heart2) pLIDA(res.p3state,time1=30,time2=300)
Produces various plots related to the p3state model, including transition probabilities,
marginal distributions, and bivariate distribution functions.
## S3 method for class 'p3state' plot( x, plot.trans = NULL, plot.marginal = NULL, plot.bivariate = NULL, time1, time2, xlab, ylab, zlab, col, col.biv = NULL, ... )## S3 method for class 'p3state' plot( x, plot.trans = NULL, plot.marginal = NULL, plot.bivariate = NULL, time1, time2, xlab, ylab, zlab, col, col.biv = NULL, ... )
x |
An object of class |
plot.trans |
Character or logical; specifies which transition probabilities to plot.
Options include |
plot.marginal |
Logical; whether to plot marginal distributions. Defaults to |
plot.bivariate |
Logical; whether to plot the bivariate distribution function. Defaults to |
time1 |
Numeric; start time for the plot. Defaults to 0 if missing. |
time2 |
Numeric; end time for the plot. Defaults to the maximum observed time. |
xlab |
Character; label for the x-axis. Defaults to "Time" if missing. |
ylab |
Character; label for the y-axis. Optional. |
zlab |
Character; label for the z-axis in 3D plots. Optional. |
col |
Color(s) used for plots. Optional. |
col.biv |
Color specification for bivariate contour plots. Optional. |
... |
Additional graphical parameters passed to plotting functions. |
Invisibly returns NULL. Plots are drawn as side effects.
## Not run: # Suponha que 'fit' é um objeto p3state ajustado plot(fit, plot.trans = "P11") plot(fit, plot.marginal = TRUE) plot(fit, plot.bivariate = TRUE) ## End(Not run)## Not run: # Suponha que 'fit' é um objeto p3state ajustado plot(fit, plot.trans = "P11") plot(fit, plot.marginal = TRUE) plot(fit, plot.bivariate = TRUE) ## End(Not run)
Provides results for an object of class ‘p3state’. It gives the estimated transition probabilities, bivariate distribution of the gap times and marginal distribution of the second gap time (the last two only available for the progressive three-state model). Also provides the results for the fit of semi-parametric Cox regression models.
## S3 method for class 'p3state' summary(object, model = NULL, covmat = NULL, estimate = NULL, time1 = NULL, time2 = NULL, ...)## S3 method for class 'p3state' summary(object, model = NULL, covmat = NULL, estimate = NULL, time1 = NULL, time2 = NULL, ...)
object |
An object of class ‘p3state’. |
model |
A character string specifying which model(s) to fit. Possible values are "TDCM", "CMM" and "CSMM". If NULL none of the regression models will be implemented. |
covmat |
Return the variance-covariance matrices? By default covmat=FALSE. |
estimate |
If TRUE nonparametric estimates are given. These include: transition probabilities, bivariate distribution function and marginal distribution of the second time (the last two only for the progressive three-state model). |
time1 |
The first time for obtaining estimates of the transition probabilities, bivariate distribution function. NULL is equivalent to 0. |
time2 |
The second time for obtaining estimates of the bivariate distribution function. |
... |
Further arguments for summary. |
No value is returned.
Luis Meira-Machado, Javier Roca-Pardinas and Artur Araújo
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. doi:10.18637/jss.v038.i03
data(heart2) res.p3state<-p3state(heart2, formula=~age+year) summary(res.p3state,model="CMM",time1=20,time2=100)data(heart2) res.p3state<-p3state(heart2, formula=~age+year) summary(res.p3state,model="CMM",time1=20,time2=100)