# NOT RUN {
require(JMcmprsk)
set.seed(123)
data(ninds)
yread <- ninds[, c(1, 2:14)]
cread <- ninds[, c(1, 15, 16, 6, 10:14)]
cread <- unique(cread)
# }
# NOT RUN {
# Please note only those variables that will appear in the model can be included
res1 <- jmo(yread, cread, out = "Y",
FE = c("group", "time3", "time6", "time12", "mrkprior",
"smlves", "lvORcs", "smlves.group", "lvORcs.group"),
cate = NULL,RE = "intercept", NP = c("smlves", "lvORcs"),
ID = "ID",intcpt = 1, quad.points = 6,
max.iter = 1000, quiet = FALSE, do.trace = FALSE)
res1
# }
# NOT RUN {
# }
# NOT RUN {
#Create two categorical variables and add them into yread
ID <- cread$ID
set.seed(100)
sex <- sample(c("Female", "Male"), nrow(cread), replace = T)
race <- sample(c("White", "Black", "Asian", "Hispanic"), nrow(cread), replace = T)
cate_var <- data.frame(ID, sex, race)
if (require(dplyr)) {
yread <- dplyr::left_join(yread, cate_var, by = "ID")
}
res2 <- jmo(yread, cread, out = "Y",
FE = c("group", "time3", "time6", "time12", "mrkprior",
"smlves", "lvORcs", "smlves.group", "lvORcs.group"), cate = c("race", "sex"),
RE = "intercept", NP = c("smlves", "lvORcs", "race", "sex"), ID = "ID",intcpt = 1,
quad.points = 20, max.iter = 10000, quiet = FALSE, do.trace = FALSE)
res2
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab