# \donttest{
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)
# }
Run the code above in your browser using DataLab