##
set.seed(123)
data(msdata_3state)
tmat_3state <- mstate::transMat(x = list(c(2, 3), c(3), c()),
names = c("State1", "State2", "State3"))
beta_est1 <- c(0.13, -0.16, -0.12, -0.20, -0.15, -0.55)
prederr(msdata = msdata_3state, X = msdata_3state[, 9:10], beta_est = beta_est1,
times = seq(0.5, 1.5, length.out = 5),state_of_interest = 2,
trans_matrix = tmat_3state,test_fraction = 0.2,quick = TRUE,verbose = TRUE)
# \donttest{
data(msdata_4state)
set.seed(123)
sub_msdata_4state <- msdata_4state[msdata_4state$id %in% sample(unique(msdata_4state$id), 10), ]
tmat_4state <- mstate::transMat(x = list(c(2, 3, 4,5), c(3, 4, 5), c(4,5), c(5),c()),
names = c("Tx", "Lrc","Fp", "Dp", "srv"))
beta_est1 <- as.numeric (c(0.13,-0.16,-0.12,-0.20,-0.15,-0.55,-0.35,-0.28,-0.34,-0.12))
times1 <- seq(0.5, 1.5, length.out = 5)
prederr(msdata = sub_msdata_4state, X = sub_msdata_4state[,9],
beta_est = beta_est1,times = times1,state_of_interest = 2,
trans_matrix = tmat_4state,test_fraction = 0.2,quick = TRUE,verbose = TRUE)
# }
##
Run the code above in your browser using DataLab