I have fitted a Bayesian discrete-time survival model with time-varying covariates as a binomial regression, adapting to the excellent material from @Solomon, here.
brm_model_surv <- brm(
event | trials(1) ~ 0 + Intercept + a + b + (1|subject),
data = data, family = binomial)
where a
and b
are the covariates that vary over time, and subject
denotes the subject that may have been measured several times (therefore the random effect).
I would now like to understand how well the model (predictions) represents the data, visually for the first. I have seen plots generated via the rstanarm
package that show the predicted survival probability to the Kaplan-Meier curve: Graphical checks of the estimated survival function — ps_check • rstanarm (mc-stan.org)
How could I achieve a similar plot with brms
? I think I will need to somehow combine the predictions by, for instance, averaging the probabilities obtained through the predict
function across runs for each subject
at certain times, but perhaps I am missing a simpler way here.
- Operating System: Windows 10
- brms Version: 2.17.0