# \donttest{
# Count outcome
eval_1 <- catecv(response = "count",
data = countExample,
score.method = "poisson",
cate.model = y ~ age + female + previous_treatment +
previous_cost + previous_number_relapses + offset(log(years)),
ps.model = trt ~ age + previous_treatment,
higher.y = FALSE,
cv.n = 5)
# default setting
plot(eval_1)
# turn off ABC annotation
plot(eval_1, show.abc = FALSE)
# use a different theme
plot(eval_1, theme = ggplot2::theme_bw())
# plot the validation curves from the 2nd CV iteration instead of the mean
# of all validation curves
plot(eval_1, cv.i = 2)
# median of the validation curves
plot(eval_1, combine = "median")
# plot validation curves in validation set only
plot(eval_1, valid.only = TRUE)
# Survival outcome
library(survival)
tau0 <- with(survivalExample,
min(quantile(y[trt == "drug1"], 0.95), quantile(y[trt == "drug0"], 0.95)))
eval_2 <- catecv(response = "survival",
data = survivalExample,
score.method = c("poisson", "randomForest"),
cate.model = Surv(y, d) ~ age + female + previous_cost +
previous_number_relapses,
ps.model = trt ~ age + previous_treatment,
initial.predictor.method = "randomForest",
ipcw.model = ~ age + previous_cost + previous_treatment,
tau0 = tau0,
cv.n = 5,
seed = 999)
# default setting, plot RMTL ratios in both training and validation sets
plot(eval_2)
# plot hazard ratio
plot(eval_2, plot.hr = TRUE)
# }
Run the code above in your browser using DataLab