Title: | Presmoothed Landmark Aalen-Johansen Estimator of Transition Probabilities for Complex Multi-State Models |
---|---|
Description: | Multi-state models are essential tools in longitudinal data analysis. One primary goal of these models is the estimation of transition probabilities, a critical metric for predicting clinical prognosis across various stages of diseases or medical conditions. Traditionally, inference in multi-state models relies on the Aalen-Johansen (AJ) estimator which is consistent under the Markov assumption. However, in many practical applications, the Markovian nature of the process is often not guaranteed, limiting the applicability of the AJ estimator in more complex scenarios. This package extends the landmark Aalen-Johansen estimator (Putter, H, Spitoni, C (2018) <doi:10.1177/0962280216674497>) incorporating presmoothing techniques described by Soutinho, Meira-Machado and Oliveira (2020) <doi:10.1080/03610918.2020.1762895>, offering a robust alternative for estimating transition probabilities in non-Markovian multi-state models with multiple states and potential reversible transitions. |
Authors: | Gustavo Soutinho [aut, cre]
|
Maintainer: | Gustavo Soutinho <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2025-02-22 05:24:55 UTC |
Source: | https://github.com/cran/presmoothedTP |
These are data from one of the first successful trials of adjuvant chemotherapy for colon cancer. Levamisole is a low-toxicity compound previously used to treat worm infestations in animals; 5-FU is a moderately toxic (as these things go) chemotherapy agent.
data("colonMSM")
data("colonMSM")
A data frame with 929 observations on the following 15 variables. Below a brief description is given for some of these variables.
Time to recurrence/censoring/death, whichever occurs first.
Recurrence/censoring indicator (recurrence=1, alive=0).
Time to censoring/death, whichever occurs first.
Death/censoring indicator (death=1, alive=0).
Treatment - Obs(ervation), Lev(amisole), Lev(amisole)+5-FU.
Sex indicator (male=1, female=0).
Age in years.
Obstruction of colon by tumour.
Perforation of colon.
Adherence to nearby organs.
Number of lymph nodes with detectable cancer.
Differentiation of tumour (1=well, 2=moderate, 3=poor).
Extent of local spread (1=submucosa, 2=muscle, 3=serosa, 4=contiguous structures).
Time from surgery to registration (0=short, 1=long).
More than 4 positive lymph nodes.
The study is originally described in Laurie (1989).The main report is found in Moertel (1990). This data set is closest to that of the final report in Moertel (1991). A version of the data with less follow-up time was used in the paper by Lin (1994).
JA Laurie, CG Moertel, TR Fleming, HS Wieand, JE Leigh, J Rubin, GW McCormack, JB Gerstner, JE Krook and J Malliard. Surgical adjuvant therapy of large-bowel carcinoma: An evaluation of levamisole and the combination of levamisole and fluorouracil: The North Central Cancer Treatment Group and the Mayo Clinic. Journal of Clinical Oncology, 7:1447-1456, 1989.
DY Lin. Cox regression analysis of multivariate failure time data: the marginal approach. Statistics in Medicine, 13:2233-2247, 1994.
CG Moertel, TR Fleming, JS MacDonald, DG Haller, JA Laurie, PJ Goodman, JS Ungerleider, WA Emerson, DC Tormey, JH Glick, MH Veeder and JA Maillard. Levamisole and fluorouracil for adjuvant therapy of resected colon carcinoma. New England Journal of Medicine, 332:352-358, 1990.
CG Moertel, TR Fleming, JS MacDonald, DG Haller, JA Laurie, CM Tangen, JS Ungerleider, WA Emerson, DC Tormey, JH Glick, MH Veeder and JA Maillard. Fluorouracil plus Levamisole as and effective adjuvant therapy after resection of stage II colon carcinoma: a final report. Annals of Internal Medicine, 122:321-326, 1991.
data(colonMSM) head(colonMSM)
data(colonMSM) head(colonMSM)
Simulated data in which the individuals can move from the initial state (State 1) to an intermediate state (State 2). From there, they may either proceed to the absorbing state (State 4), passing through another intermediate state (State 3), or move directly from the initial state to the absorbing state.
data("data")
data("data")
A data frame with 500 observations on the following 6 variables.
y1
First gap time.
state1
Indicator of the first gap time; 0 if the first time is censored and 1 otherwise.
y2
Second gap time.
state2
Censoring indicator of the second gap time; 0 if the total time is censored and 1 otherwise.
y3
Third gap time.
state3
Censoring indicator of the third gap time; 0 if the total time is censored and 1 otherwise.
data(data)
data(data)
A data frame of 2279 patients transplanted at the EBMT between 1985 and 1998. These data were used in Fiocco, Putter & van Houwelingen (2008), van Houwelingen & Putter (2008, 2012) and de Wreede, Fiocco & Putter (2011). The included variables are
Patient identification number
Time in days from transplantation to recovery or last follow-up
Recovery status; 1 = recovery, 0 = censored
Time in days from transplantation to adverse event (AE) or last follow-up
Adverse event status; 1 = adverse event, 0 = censored
Time in days from transplantation to both recovery and AE or last follow-up
Recovery and AE status; 1 = both recovery and AE, 0 = no recovery or no AE or censored
Time in days from transplantation to relapse or last follow-up
Relapse status; 1 = relapse, 0 = censored
Time in days from transplantation to death or last follow-up
Relapse status; 1 = dead, 0 = censored
Year of transplantation; factor with levels "1985-1989", "1990-1994", "1995-1998"
Patient age at transplant; factor with levels "<=20", "20-40", ">40"
Prophylaxis; factor with levels "no", "yes"
Donor-recipient gender match; factor with levels "no gender mismatch", "gender mismatch"
data("ebmt4")
data("ebmt4")
A data frame, see data.frame.
Gustavo Soutinho and Luis Meira-Machado.
We acknowledge the European Society for Blood and Marrow Transplantation (EBMT) for making available these data. Disclaimer: these data were simplified for the purpose of illustration of the analysis of competing risks and multi-state models and do not reflect any real life situation. No clinical conclusions should be drawn from these data.
Fiocco M, Putter H, van Houwelingen HC (2008). Reduced-rank proportional hazards regression and simulation-based prediction for multi-state models. Statistics in Medicine 27, 4340-4358.
van Houwelingen HC, Putter H (2008). Dynamic predicting by landmarking as an alternative for multi-state modeling: an application to acute lymphoid leukemia data. Lifetime Data Anal 14, 447-463.
van Houwelingen HC, Putter H (2012). Dynamic Prediction in Clinical Survival Analaysis. Chapman & Hall/CRC Press, Boca Raton.
de Wreede LC, Fiocco M, and Putter H (2011). mstate: An R Package for the Analysis of Competing Risks and Multi-State Models. Journal of Statistical Software, Volume 38, Issue 7.
data(ebmt4) head(ebmt4)
data(ebmt4) head(ebmt4)
This function converts a data set which is in wide format (one subject per line, multiple columns indicating time and status for different states) into a data set in long format (one line for each transition for which a subject is at risk). Selected covariates are replicated per subjects.
prepTP(data, trans, times.names, status.names)
prepTP(data, trans, times.names, status.names)
data |
Data frame in wide format in which to interpret time, status, id or keep, if appropriate. |
trans |
Transition matrix describing the states and transitions in the multi-state model. If S is the number of states in the multi-state model, trans should be an S x S matrix, with (i,j)-element a positive integer if a transition from i to j is possible in the multi-state model, NA otherwise. In particular, all diagonal elements should be NA. The integers indicating the possible transitions in the multi-state model should be sequentially numbered, 1,...,K, with K the number of transitions. |
times.names |
Either 1) a matrix or data frame of dimension n x S (n being the number of individuals and S the number of states in the multi-state model), containing the times at which the states are visited or last follow-up time, or 2) a character vector of length S containing the column names indicating these times. In the latter cases, some elements of time may be NA, see Details. |
status.names |
Either 1) a matrix or data frame of dimension n x S, containing, for each of the states, event indicators taking the value 1 if the state is visited or 0 if it is not (censored), or 2) a character vector of length S containing the column names indicating these status variables. In the latter cases, some elements of status may be NA, see Details. |
An object of class "msdata", which is a data frame in long (counting process) format containing the subject id, the covariates (replicated per subject), and from the starting state to the receiving state trans the transition number Tstart the starting time of the transition Tstop the stopping time of the transition status status variable, with 1 indicating an event (transition), 0 a censoring
Gustavo Soutinho and Luis Meira-Machado.
data("ebmt4") db_wide <- ebmt4 positions<-list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6), c(5, 6), c(6), c()) states.names = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death") trans<-transTP(positions, states.names) times.names = c(NA, "rec", "ae","recae", "rel", "srv") status.names=c(NA, "rec.s", "ae.s", "recae.s", "rel.s", "srv.s") prepTP(data=db_wide, trans, times.names, status.names)
data("ebmt4") db_wide <- ebmt4 positions<-list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6), c(5, 6), c(6), c()) states.names = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death") trans<-transTP(positions, states.names) times.names = c(NA, "rec", "ae","recae", "rel", "srv") status.names=c(NA, "rec.s", "ae.s", "recae.s", "rel.s", "srv.s") prepTP(data=db_wide, trans, times.names, status.names)
This function is used to obtain nonparametric presmoothed estimates of the transition probabilities for any type of multistate model, including models that allow for reversible transitions, and potencially non-Markovian seetings. The methods used to compute the transition probabilities are ”PLM” (given by a ”logistic” model), ”cauchit”, ”probit”. The proposed presmoothed estimator is designed to handle complex multi-state models with more than three states, as well as reversible transitions, accommodating potentially non-Markovian behaviors.
presmoothTP(data, s, from, to, method = "LM", trans)
presmoothTP(data, s, from, to, method = "LM", trans)
data |
A data frame in the long format containing the subject id; from corresponding to the starting state; the receiving state, to; the transition number, trans; the starting time of the transition given by Tstart; the stopping time of the transition, Tstop, and status for the status variable, with 1 indicating an event (transition), 0 a censoring. |
s |
The first time for obtaining estimates for the transition. |
from |
The starting state of the transition probabilities. |
to |
The last receiving state considered for the estimation of the transition probabilities. |
method |
The method used to compute the transition probabilities.
Possible options are |
trans |
The transition matrix for multi-state model. |
Nonparametric presmoothed estimates of transition probabilities based on logistic’, ’probit’, and ’cauchit’ distributions (PLM,cauchit and probit).
Gustavo Soutinho and Luis Meira-Machado.
data("ebmt4") db_wide <- ebmt4 positions<-list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6), c(5, 6), c(6), c()) states.names = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death") trans<-transTP(positions, states.names) times.names = c(NA, "rec", "ae","recae", "rel", "srv") status.names=c(NA, "rec.s", "ae.s", "recae.s", "rel.s", "srv.s") data.long<-prepTP(data=db_wide, trans, times.names, status.names) res1<-presmoothTP(data.long, s = 100, from = 1, to = 1, method = 'PLM', trans=trans) res2<-presmoothTP(data.long, s = 100, from = 1, to = 1, method = 'cauchit', trans=trans) res3<-presmoothTP(data.long, s = 100, from = 1, to = 1, method = 'probit', trans=trans) plot(res1, type='s', xlim=c(100,3000), ylim=c(0.6,1), ylab=c('p11(100,t)')) lines(res2, type='s', col=2) lines(res3, type='s', col=4) legend("topright", legend = c("PLM","Cauchit", "Probit"), lwd = 0.3, col = c(1,2,4), cex=0.7, lty=c(1, 1)) res4<-presmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'PLM', trans=trans) res5<-presmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'cauchit', trans=trans) res6<-presmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'probit', trans=trans) plot(res4, type='s', xlim=c(1000,3000), ylim=c(0,0.12),ylab=c('p26(1000,t)')) lines(res5, type='s', col=2) lines(res6, type='s', col=4) legend("topright", legend = c("PLM","Cauchit", "Probit"), lwd = 0.3, col = c(1,2,4), cex=0.7, lty=c(1, 1))
data("ebmt4") db_wide <- ebmt4 positions<-list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6), c(5, 6), c(6), c()) states.names = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death") trans<-transTP(positions, states.names) times.names = c(NA, "rec", "ae","recae", "rel", "srv") status.names=c(NA, "rec.s", "ae.s", "recae.s", "rel.s", "srv.s") data.long<-prepTP(data=db_wide, trans, times.names, status.names) res1<-presmoothTP(data.long, s = 100, from = 1, to = 1, method = 'PLM', trans=trans) res2<-presmoothTP(data.long, s = 100, from = 1, to = 1, method = 'cauchit', trans=trans) res3<-presmoothTP(data.long, s = 100, from = 1, to = 1, method = 'probit', trans=trans) plot(res1, type='s', xlim=c(100,3000), ylim=c(0.6,1), ylab=c('p11(100,t)')) lines(res2, type='s', col=2) lines(res3, type='s', col=4) legend("topright", legend = c("PLM","Cauchit", "Probit"), lwd = 0.3, col = c(1,2,4), cex=0.7, lty=c(1, 1)) res4<-presmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'PLM', trans=trans) res5<-presmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'cauchit', trans=trans) res6<-presmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'probit', trans=trans) plot(res4, type='s', xlim=c(1000,3000), ylim=c(0,0.12),ylab=c('p26(1000,t)')) lines(res5, type='s', col=2) lines(res6, type='s', col=4) legend("topright", legend = c("PLM","Cauchit", "Probit"), lwd = 0.3, col = c(1,2,4), cex=0.7, lty=c(1, 1))
A data frame of 488 liver cirrhosis patients from a randomized clinical trial concerning prednisone treatment in these patients. The dataset is in long format. The included variables are
Patient identification number
Starting state
Receiving state
Transition number
Starting time
Transition time
Status variable; 1=transition, 0=censored
Treatment; factor with levels "Placebo", "Prednisone"
data("prothr")
data("prothr")
A data frame, see data.frame.
Gustavo Soutinho and Luis Meira-Machado.
This data was kindly provided by Per Kragh Andersen. It was introduced in Andersen, Borgan, Gill & Keiding (1993), Example 1.3.12, and used as illustration for computation of transition probabilities in multi-state models, see Sections IV.4 (Example IV.4.4) and VII.2 (Example VII.2.10).
Andersen PK, Borgan O, Gill RD, Keiding N (1993). Statistical Models Based on Counting Processes. Springer, New York.
data(prothr) head(prothr)
data(prothr) head(prothr)
Define transition matrices for multi-state model. Specific functions for defining such transition matrices are pre-defined for common multi-state models like the competing risks model and the illness-death model.
transTP(positions, states.names)
transTP(positions, states.names)
positions |
List of possible transitions; x[[i]] consists of a vector of state numbers reachable from state i. |
states.names |
A character vector containing the names of either the competing risks or the states in the multi-state model specified by the competing risks or illness-death model. names should have the same length as the list x (for transMat), or either K or K+1 (for trans.comprisk), or 3 (for trans.illdeath). |
A transition matrix describing the states and transitions in the multi-state model.
Gustavo Soutinho and Luis Meira-Machado.
data("ebmt4") db_wide <- ebmt4 positions<-list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6), c(5, 6), c(6), c()) states.names = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death") transTP(positions, states.names)
data("ebmt4") db_wide <- ebmt4 positions<-list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6), c(5, 6), c(6), c()) states.names = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death") transTP(positions, states.names)
This function is used to obtain nonparametric unsmoothed estimates of the transition probabilities. The methods used to compute the transition probabilities are ”AJ” and ”LM” which can be also applied for any type of multistate model, including models that allow for reversible transitions, and potencially non-Markovian seetings.
unsmoothTP(data, s, from, to, method = "LM", trans = trans)
unsmoothTP(data, s, from, to, method = "LM", trans = trans)
data |
A data frame in the long format containing the subject id; from corresponding to the starting state; the receiving state, to; the transition number, trans; the starting time of the transition given by Tstart; the stopping time of the transition, Tstop, and status for the status variable, with 1 indicating an event (transition), 0 a censoring. |
s |
The first time for obtaining estimates for the transition. |
from |
The starting state of the transition probabilities. |
to |
The last receiving state considered for the estimation of the transition probabilities. |
method |
The method used to compute the transition probabilities.
Possible options are |
trans |
The transition matrix for multi-state model. |
Nonparametric estimates of transition probabilities in general multi-state models using the AJ and the LMAJ estimators.
data("ebmt4") db_wide <- ebmt4 positions<-list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6), c(5, 6), c(6), c()) states.names = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death") trans<-transTP(positions, states.names) times.names = c(NA, "rec", "ae","recae", "rel", "srv") status.names=c(NA, "rec.s", "ae.s", "recae.s", "rel.s", "srv.s") data.long<-prepTP(data=db_wide, trans, times.names, status.names) res1<-unsmoothTP(data.long, s = 100, from = 1, to = 1, method = 'AJ', trans=trans) head(res1) res2<-unsmoothTP(data.long, s = 100, from = 1, to = 1, method = 'LM', trans=trans) head(res2) plot(res1, type='s', xlim=c(0,3000), ylim=c(0.6,1), ylab=c('p11(100,t)')) lines(res2, type='s', col=2) legend("topright", legend = c("AJ","LM"), lwd = 0.3, col = c(1,2), cex=0.7, lty=c(1, 1)) res3<-unsmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'AJ', trans=trans) res4<-unsmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'LM', trans=trans) plot(res3, type='s', xlim=c(1000,3000), ylim=c(0,0.12), ylab=c('p26(100,t)')) lines(res4, type='s', col=2) legend("topright", legend = c("AJ","LM"), lwd = 0.3, col = c(1,2), cex=0.7, lty=c(1, 1))
data("ebmt4") db_wide <- ebmt4 positions<-list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6), c(5, 6), c(6), c()) states.names = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death") trans<-transTP(positions, states.names) times.names = c(NA, "rec", "ae","recae", "rel", "srv") status.names=c(NA, "rec.s", "ae.s", "recae.s", "rel.s", "srv.s") data.long<-prepTP(data=db_wide, trans, times.names, status.names) res1<-unsmoothTP(data.long, s = 100, from = 1, to = 1, method = 'AJ', trans=trans) head(res1) res2<-unsmoothTP(data.long, s = 100, from = 1, to = 1, method = 'LM', trans=trans) head(res2) plot(res1, type='s', xlim=c(0,3000), ylim=c(0.6,1), ylab=c('p11(100,t)')) lines(res2, type='s', col=2) legend("topright", legend = c("AJ","LM"), lwd = 0.3, col = c(1,2), cex=0.7, lty=c(1, 1)) res3<-unsmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'AJ', trans=trans) res4<-unsmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'LM', trans=trans) plot(res3, type='s', xlim=c(1000,3000), ylim=c(0,0.12), ylab=c('p26(100,t)')) lines(res4, type='s', col=2) legend("topright", legend = c("AJ","LM"), lwd = 0.3, col = c(1,2), cex=0.7, lty=c(1, 1))