Type: | Package |
Title: | Methods for Checking the Markov Condition in Multi-State Survival Data |
Version: | 0.1.3 |
Description: | The inference in multi-state models is traditionally performed under a Markov assumption that claims that past and future of the process are independent given the present state. In this package, we consider 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 in Cox models for the transition intensities; methods based on measuring the discrepancy of the non-Markov estimators of the transition probabilities to the Markov Aalen-Johansen estimators; and, finally, methods that were developed by considering summaries from families of log-rank statistics where patients are grouped by the state occupied of the process at a particular time point (see Soutinho G, Meira-Machado L (2021) <doi:10.1007/s00180-021-01139-7> and Titman AC, Putter H (2020) <doi:10.1093/biostatistics/kxaa030>). |
License: | GPL-3 |
Depends: | R (≥ 3.5.0) |
Imports: | survival, mstate |
RoxygenNote: | 7.2.1 |
Encoding: | UTF-8 |
LazyLoad: | yes |
LazyData: | yes |
NeedsCompilation: | yes |
Suggests: | rmarkdown, knitr, doParallel, devtools, bibtex, testthat |
VignetteBuilder: | knitr |
Packaged: | 2023-02-15 08:54:35 UTC; asus |
Author: | Gustavo Soutinho |
Maintainer: | Gustavo Soutinho <gustavosoutinho@sapo.pt> |
Repository: | CRAN |
Date/Publication: | 2023-02-15 09:10:02 UTC |
Global test and local test for checking the Markov condition on Multi-state Models based on the Area Under the two curves (AUC) given by the non-Markov estimators of the transition probabilities to the Markov Aalen-Johansen estimators.
Description
This function is used to obtain the local and global tests for checking the Markov condition.
Usage
AUC.test(
data,
from = 1,
to = 3,
type = "global",
times = NULL,
quantiles = c(0.05, 0.1, 0.2, 0.3, 0.4),
tmat = NULL,
replicas = 10,
limit = 0.9,
positions = list(c(2, 3), c(3), c()),
namesStates = c("Alive", "Rec", "Death"),
timesNames = c(NA, "time1", "Stime"),
status = c(NA, "event1", "event")
)
Arguments
data |
A data frame in long format containing the subject |
from |
The starting state of the transition probabilities. |
to |
The last receiving state considered for the estimation of the transition probabilities. All the probabilities among the first and the last states are also computed. |
type |
Type of test for checking the Markov condition: "local" or "global". By default type='global'. |
times |
For the local test, times represents the starting times of the transition probabilities. In case of a global test, the argument is given by times between the minimum time and the third quartile times used in the formula of this test. Default to NULL. |
quantiles |
Quantiles used in the formula of the Global test for the AUC methods. By default takes the percentiles 0.05, 0.10, 0.20, 0.30, 0.40. |
tmat |
The transition matrix for multi-state model. |
replicas |
Number of replicas for the Monte Carlo simulation to standardization of the T-statistic given by the difference of the areas of AJ and LM transition probabilities estimates. |
limit |
Percentile of the event time used as the upper bound for the computation of the AUC-based test. |
positions |
List of possible transitions; x[[i]] consists of a vector of state numbers reachable from state i. |
namesStates |
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). |
timesNames |
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 |
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. |
Value
In case of the AUC global test, an object with a list with the following outcomes:
globalTest |
p-value of AUC global tests for each transition. These values are obtained through the minimum of the means of each two contiguous quantiles times of the AUC global tests. |
localTest |
AUC local tests of the transition probability for each times and transitions. |
quantiles |
Quantiles times used for the AUC global tests. |
times |
Times used for the AUC global tests. |
DIF |
Differences between the AJ and the LMAJ estimates for each transition probabilites from the starting state until the receiving state given by only one replica where 's' represent each of the quantile times. |
from |
The starting state considered for the AUC global tests. |
to |
The last receiving state considered for the the AUC Local tests. |
ET.qiAll |
The lower limit of the diferences between the AJ and the LMAJ
estimates given by the Monte Carlo simulation in each transition for each "s"
quantile times. |
ET.qsAll |
The upper limit of the diferences between the AJ and the LMAJ
estimates given by the Monte Carlo simulation in each transition for each "s"
quantile times. |
replicas |
Number of replicas for the Monte Carlo simulation. |
limit |
Percentil of the times used in the AUC global tests. |
In case of the AUC local test, an object with a list with the following outcomes:
localTest |
p-value of AUC local tests for each times and transitions. |
trans |
The transition matrix describing the states and transitions of the multi-state model. |
times |
Times selected for the AUC Local tests. |
DIF |
Differences between the AJ and the LMAJ estimates for each transition probabilites from the starting state until the receiving state given by only one replica where 's' represent each of the quantile times. |
from |
The starting state considered for the AUC Local tests. |
to |
The last receiving state considered for the the AUC Local tests. |
ET.qiAll |
The lower limit of the diferences between the AJ and the LMAJ
estimates given by the Monte Carlo simulation in each transition for each "s"
quantile times. |
ET.qsAll |
The upper limit of the diferences between the AJ and the LMAJ
estimates given by the Monte Carlo simulation in each transition for each "s"
quantile times. |
replicas |
Number of replicas for the Monte Carlo simulation. |
limit |
Percentil of the times used in the AUC local tests. |
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
References
Soutinho G, Meira-Machado L (2021). Methods for checking the Markov condition in multi-state survival data. Computational Statistics. de Una-alvarez J, Meira-Machado L (2015). Nonparametric estimation of transition probabilities in the non-Markov illness-death model: A comparative study. Biometrics, 71(2), 364-375. Putter H, Spitoni C (2018). 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. Meira-Machado L, Sestelo M (2019). Estimation in the progressive illness-death model: A nonexhaustive review. Biometrical Journal, 61(2), 245-263.
Examples
set.seed(1234)
library(markovMSM)
data("colonMSM")
db_wide<-colonMSM
positions<-list(c(2, 3), c(3), c())
namesStates = c("Alive", "Rec", "Death")
tmat <-transMatMSM(positions, namesStates)
timesNames = c(NA, "time1","Stime")
status=c(NA, "event1","event")
trans = tmat
db_long<- prepMSM(data=db_wide, trans, timesNames, status)
res<-AUC.test(data=db_long, times=180, from=1, to=3, type='local',
replicas = 20, tmat = tmat)
res$localTest
res2<-AUC.test(data=db_long, times=180, from=2, to=3, type='local',
replicas = 20, tmat = tmat)
res2$localTest
res3<-AUC.test(data=db_long, from=1, to=3, replicas = 20, tmat=tmat)
round(res3$globalTest,3)
res4<-AUC.test(data=db_long, from=2, to=3, type='global', replicas = 20,
tmat=tmat)
round(res4$globalTest,3)
round(res4$localTest,3)
round(res4$localTest,3)
#AUC global for the individuals with the treatment "Obs" of covariate `"rx"
#for colonMSM data set
set.seed(12345)
db_wide.obs<-db_wide[db_wide$rx=='Obs',]
db_long.obs <- prepMSM(data = db_wide.obs, trans, timesNames, status)
res3a<-AUC.test(data=db_long.obs, times=365, from=1, to=3,
type='local', replicas= 20, tmat = tmat)
res3a$localTest
set.seed(12345)
res4a<-AUC.test(data=db_long.obs, times=365, from=2, to=3,
type='local', replicas= 20, tmat = tmat)
res4a$localTest
#' data("ebmt4")
db_wide <- ebmt4
positions <- list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6),
c(5, 6), c(), c())
state.names <- c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death")
tmat <-transMatMSM(positions, state.names)
timesNames <- c(NA, "rec", "ae","recae", "rel", "srv")
status <- c(NA, "rec.s", "ae.s", "recae.s","rel.s", "srv.s")
trans <- tmat
db_long <- prepMSM(data=db_wide, trans, timesNames, status)
db_long[1:10,]
res5<-AUC.test(data=db_long, from=1, to=5, type='global',
quantiles=c(.05, .10, .20, .30, 0.40),
tmat = tmat, replicas = 5,
positions=positions, namesStates=state.names,
timesNames=timesNames, status=status)
round(res5$globalTest, 4)
round(res5$localTests,4)
res6<-AUC.test(data = prothr, from=2, to=3,
type='global', replicas= 5, limit=0.90,
quantiles=c(.05, .10, .20, .30, 0.40))
round(res6$globalTest,4)
round(res6$localTests,4)
Log-rank based test for the validity of the Markov assumption.
Description
Function LR.test performs the log-rank test described in Titman & Putter (2020).
Usage
LR.test(
data,
times = times,
from,
to,
replicas = 1000,
formula = NULL,
fn = list(function(x) mean(abs(x), na.rm = TRUE)),
fn2 = list(function(x) mean(x, na.rm = TRUE)),
min_time = 0,
other_weights = NULL,
dist = c("poisson", "normal")
)
Arguments
data |
Multi-state data in |
times |
Grid of time points at which to compute the statistic. |
from |
The starting state of the transition to check the Markov condition. |
to |
The last state of the considered transition to check the Markov condition. |
replicas |
Number of wild bootstrap replications to perform. |
formula |
Right-hand side of the formula. If NULL will fit with no covariates (formula="1" will also work), offset terms can also be specified. |
fn |
A list of summary functions to be applied to the individual zbar traces (or a list of lists) |
fn2 |
A list of summary functions to be applied to the overall chi-squared trace |
min_time |
The minimum time for calculating optimal weights |
other_weights |
Other (than optimal) weights can be specified here |
dist |
Distribution of wild bootstrap random weights, either "poisson" for centred Poisson (default), or "normal" for standard normal |
Value
LR.test returns an object of class "markovMSM", which is a list with the following items:
localTestLR |
p-value of AUC local tests for each times and transitions. |
globalTestLR |
p-value of AUC global tests for each transition |
times |
Grid of time points at which to compute the statistic. |
replicas |
Number of wild bootstrap replications to perform. |
call |
Expression of the LR.test used. |
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
References
Titman AC, Putter H (2020). General tests of the Markov property in multi-state models. Biostatistics.
Examples
set.seed(1234)
library(markovMSM)
data("colonMSM")
positions<-list(c(2, 3), c(3), c())
namesStates = c("Alive", "Rec", "Death")
tmat <-transMatMSM(positions, namesStates)
timesNames = c(NA, "time1","Stime")
status=c(NA, "event1","event")
trans = tmat
db_long<- prepMSM(data=colonMSM, trans, timesNames, status)
res<-LR.test(data=db_long, times=180, from = 2, to = 3, replicas = 1000)
res$globalTestLR
times<-c(73.5, 117, 223, 392, 681)
res2<-LR.test(data=prothr, times=times, from = 2, to = 3, replicas = 1000)
res2$localTestLR
res2$globalTestLR
res3<-LR.test(data=prothr, times=times, from = 2, to = 1, replicas = 1000)
res3$localTestLR
res3$globalTestLR
Cox PH global test for checking the Markov condition on Multi-state Models.
Description
This function is used to obtain a global test to check the Markov condition for each transition based on Cox Proportional hazard models.
Usage
PHM.test(data, from, to)
Arguments
data |
A data frame in long format containing the subject |
from |
The starting state of the transition to check the Markov condition. |
to |
The last state of the considered transition to check the Markov condition. |
Value
An object with a list with the following outcomes:
p.value |
p-value of Cox global tests for each transition. |
from |
The starting state of the transition to check the Markov condition. |
to |
The last state of the considered transition to check the Markov condition. |
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
References
Kay, R (1986). A Markov model for analyzing cancer markers and disease states in survival studies. Biometrics 42, 457-481. Soutinho G, Meira-Machado L (2021). Methods for checking the Markov condition in multi-state survival data. Computational Statistics.
Examples
library(markovMSM)
data("colonMSM")
db_wide<-colonMSM
positions<-list(c(2, 3), c(3), c())
namesStates = c("Alive", "Rec", "Death")
tmat <-transMatMSM(positions, namesStates)
timesNames = c(NA, "time1","Stime")
status=c(NA, "event1","event")
trans = tmat
db_long<- prepMSM(data=db_wide, trans, timesNames, status)
res1<-PHM.test(data=db_long, from = 2, to=3)
res1
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())
namesStates = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death")
tmat <-transMatMSM(positions, namesStates)
timesNames = c(NA, "rec", "ae","recae", "rel", "srv")
status=c(NA, "rec.s", "ae.s", "recae.s","rel.s", "srv.s")
trans = tmat
db_long<- prepMSM(data=db_wide, trans, timesNames, status)
db_long$trans<-as.factor(db_long$trans)
res2<-PHM.test(data=db_long, from = 5, to=6)
res2$p.value
res2$from
res2$to
Chemotherapy for Stage B/C colon cancer.
Description
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.
Usage
data("colonMSM")
Format
A data frame with 929 observations on the following 15 variables. Below a brief description is given for some of these variables.
- time1
Time to recurrence/censoring/death, whichever occurs first.
- event1
Recurrence/censoring indicator (recurrence=1, alive=0).
- Stime
Time to censoring/death, whichever occurs first.
- event
Death/censoring indicator (death=1, alive=0).
- rx
Treatment - Obs(ervation), Lev(amisole), Lev(amisole)+5-FU.
- sex
Sex indicator (male=1, female=0).
- age
Age in years.
- obstruct
Obstruction of colon by tumour.
- perfor
Perforation of colon.
- adhere
Adherence to nearby organs.
- nodes
Number of lymph nodes with detectable cancer.
- differ
Differentiation of tumour (1=well, 2=moderate, 3=poor).
- extent
Extent of local spread (1=submucosa, 2=muscle, 3=serosa, 4=contiguous structures).
- surg
Time from surgery to registration (0=short, 1=long).
- node4
More than 4 positive lymph nodes.
Source
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).
References
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.
Examples
data(colonMSM)
head(colonMSM)
Data from the European Society for Blood and Marrow Transplantation (EBMT).
Description
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
- id
Patient identification number
- rec
Time in days from transplantation to recovery or last follow-up
- rec.s
Recovery status; 1 = recovery, 0 = censored
- ae
Time in days from transplantation to adverse event (AE) or last follow-up
- ae.s
Adverse event status; 1 = adverse event, 0 = censored
- recae
Time in days from transplantation to both recovery and AE or last follow-up
- recae.s
Recovery and AE status; 1 = both recovery and AE, 0 = no recovery or no AE or censored
- rel
Time in days from transplantation to relapse or last follow-up
- rel.s
Relapse status; 1 = relapse, 0 = censored
- srv
Time in days from transplantation to death or last follow-up
- srv.s
Relapse status; 1 = dead, 0 = censored
- year
Year of transplantation; factor with levels "1985-1989", "1990-1994", "1995-1998"
- agecl
Patient age at transplant; factor with levels "<=20", "20-40", ">40"
- proph
Prophylaxis; factor with levels "no", "yes"
- match
Donor-recipient gender match; factor with levels "no gender mismatch", "gender mismatch"
Usage
data("ebmt4")
Format
A data frame, see data.frame.
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
Source
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.
References
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.
Examples
data(ebmt4)
head(ebmt4)
Count number of observed transitions.
Description
Given a data set in long format, for instance generated by msprep, and a transition matrix for the multi-state model, this function counts the number of observed transitions in the multi-state model and gives their percentages.
Usage
eventsMSM(data)
Arguments
data |
A data frame in long (counting process) format such as the output by prepMSM. |
Value
A list containing two tables, the first, called Frequencies, with the number of observed transitions in the multi-state model occurring in msdata, the second, called Proportions, with the corresponding proportions.
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
Examples
library(mstate)
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())
namesStates = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death")
trans<-transMatMSM(positions, namesStates)
timesNames = c(NA, "rec", "ae","recae", "rel", "srv")
status=c(NA, "rec.s", "ae.s", "recae.s", "rel.s", "srv.s")
db_long<-prepMSM(data=db_wide, trans, timesNames, status)
eventsMSM(db_long)
Plot for an object of class "markovMSM"
Description
Plots for the visual inspection for checking the Markov condition through the difference between the AJ and LMAJ from a starting time of the transition probabilities for each transition.
Usage
## S3 method for class 'markovMSM'
plot(x = object, to=2, quantileOrder = NULL,
axis.scale = c(-1, 1), difP = FALSE, ...)
Arguments
x |
A dataframe in long format in case of the plot with the differences between AJ and LMAJ estimators or a object of class "markovMSM" with the results of the global.test or local.test function. |
to |
The last receiving state considered for the estimation of the transition probabilities. Plot of the transition probabilities between the starting to this state is shown. |
quantileOrder |
Order of the quantil used in the formula of the AUC global test. |
axis.scale |
Limit of the y axis of the plots. |
difP |
Type of plot representing in case of x means the results of the Localtest. If difP=TRUE plot depicts the discrepancies between AJ and LMAJ estimators. If difP=FALSE plot show the AJ and the LMAJ estimates. By default difP=FALSE. |
... |
For future methods. |
Value
No value is returned.
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
References
Soutinho G, Meira-Machado L (2021). Methods for checking the Markov condition in multi-state survival data. Computational Statistics.
Examples
library(markovMSM)
data(prothr)
res<-AUC.test(data=prothr, times=30, from=1, to=3, type='local',
replicas=10)
plot(res, to=3, axis.scale=c(-0.25,.25), difP=TRUE)
plot(res, to=2, axis.scale=c(0,.25), difP=FALSE)
res2<-AUC.test(data=prothr, from=1, to=3,
type='global', replicas=10, limit=0.90, quantiles=c(.05, .10, .20, .30, 0.40))
plot(res2, quantileOrder=3, 2, axis.scale=c(-0.05,.15))
Function to prepare data set for multi-state modeling in long format from data set in wide format.
Description
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.
Usage
prepMSM(data, trans, timesNames, status)
Arguments
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 |
timesNames |
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 |
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. |
Value
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
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
Examples
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())
namesStates = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death")
trans<-transMatMSM(positions, namesStates)
timesNames = c(NA, "rec", "ae","recae", "rel", "srv")
status=c(NA, "rec.s", "ae.s", "recae.s", "rel.s", "srv.s")
prepMSM(data=db_wide, trans, timesNames, status)
Pritting fits of "markovMSM" class.
Description
Returns the formula and the methods of the Markov tests in Multi-state models.
Usage
## S3 method for class 'markovMSM'
print(x, ...)
Arguments
x |
A object of "markovMSM" with the results of the AUC global or local tests. |
... |
For future methods. |
Value
The formula and the methods of the Markov tests in Multi-state models.
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
References
Soutinho G, Meira-Machado L (2021). Methods for checking the Markov condition in multi-state survival data. Computational Statistics.
Examples
library(markovMSM)
data("colonMSM")
db_wide<-colonMSM
positions<-list(c(2, 3), c(3), c())
namesStates = c("Alive", "Rec", "Death")
tmat <-transMatMSM(positions, namesStates)
timesNames = c(NA, "time1","Stime")
status=c(NA, "event1","event")
trans = tmat
db_long<- prepMSM(data=db_wide, trans, timesNames, status)
times=365
res<-AUC.test(data = db_long, times=times, from=2, to=3, type='local',
replicas=2, tmat = tmat)
print(res)
Liver cirrhosis data - Abnormal prothrombin levels in liver cirrhosis.
Description
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
- id
Patient identification number
- from
Starting state
- to
Receiving state
- trans
Transition number
- Tstart
Starting time
- Tstop
Transition time
- status
Status variable; 1=transition, 0=censored
- treat
Treatment; factor with levels "Placebo", "Prednisone"
Usage
data("prothr")
Format
A data frame, see data.frame.
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
Source
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).
References
Andersen PK, Borgan O, Gill RD, Keiding N (1993). Statistical Models Based on Counting Processes. Springer, New York.
Examples
data(prothr)
head(prothr)
Summarizing fits of "markovMSM" class.
Description
Returns the p-values of the AUC global and Local tests. Further information on the test are also given.
Usage
## S3 method for class 'markovMSM'
summary(object, ...)
Arguments
object |
A object of "markovMSM" with the results of the AUC global or local tests. |
... |
For future methods. |
Value
The p-values of the AUC global and Local tests. Further information on the test are also given.
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
References
Soutinho G, Meira-Machado L (2021). Methods for checking the Markov condition in multi-state survival data. Computational Statistics.
Examples
library(markovMSM)
data("colonMSM")
db_wide<-colonMSM
positions<-list(c(2, 3), c(3), c())
namesStates = c("Alive", "Rec", "Death")
tmat <-transMatMSM(positions, namesStates)
timesNames = c(NA, "time1","Stime")
status=c(NA, "event1","event")
trans = tmat
db_long<- prepMSM(data=db_wide, trans, timesNames, status)
times=365
res<-AUC.test(data = db_long, times=times, from=2, to=3, type='local',
replicas=2, tmat = tmat)
res$localTest
summary(res)
Define transition matrix for multi-state model.
Description
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.
Usage
transMatMSM(positions, namesStates)
Arguments
positions |
List of possible transitions; x[[i]] consists of a vector of state numbers reachable from state i. |
namesStates |
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). |
Value
A transition matrix describing the states and transitions in the multi-state model.
Author(s)
Gustavo Soutinho and Luis Meira-Machado.
Examples
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())
namesStates = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death")
transMatMSM(positions, namesStates)