# Using competing risks data out of initial state (see vignette: ... -in-competing-risk-setting).
# Estimate and plot MLR-IPCW calibration scatter plots for the predicted transition
# probabilities at time t = 1826, when predictions were made at time
# s = 0 in state j = 1. These predicted transition probabilities are stored in tp_cmprsk_j0.
# To minimise example time we reduce the datasets to 150 individuals.
# Extract the predicted transition probabilities out of state j = 1 for first 150 individuals
tp_pred <- tp_cmprsk_j0 |>
dplyr::filter(id %in% 1:150) |>
dplyr::select(any_of(paste("pstate", 1:6, sep = "")))
# Reduce ebmtcal to first 150 individuals
ebmtcal <- ebmtcal |> dplyr::filter(id %in% 1:150)
# Reduce msebmtcal_cmprsk to first 150 individuals
msebmtcal_cmprsk <- msebmtcal_cmprsk |> dplyr::filter(id %in% 1:150)
# Now estimate the observed event probabilities for each possible transition.
dat_calib <-
calib_msm(data_ms = msebmtcal_cmprsk,
data_raw = ebmtcal,
j=1,
s=0,
t = 1826,
tp_pred = tp_pred,
calib_type = "mlr",
w_covs = c("year", "agecl", "proph", "match"),
mlr_ps_int = 2,
mlr_degree = 2)
# These are then plotted
plot(dat_calib, combine = TRUE, nrow = 2, ncol = 3)
Run the code above in your browser using DataLab