Is there a simpler way than specifying *full* new data frames when wanting to predict using a brms fit?

So if I were wanting to predict survival probabilities using a cph model in R, I could simply do something like the following:

p1 <- data.frame(Predict(m1, isdiabetes="Yes", ageyear=seq(35,85,0.1), time=30))

Where m1 is my model, and isdiabetes and ageyear are both predictors in m1, amongst a (large number) of others.

If I am now in brms world, I fit my model again, and would like to produce a similar set of predictions based on varying a single predictor alongside specifying the presence of some comorbidty like diabetes in this case. It seems that my only option is to specify a big data frame explicitly setting all other predictors to their “null” values and using predict in order to replicate this behaviour, or is there an alternative that is easier than this? It is of course not the worst problem in the world and potentially niche, but I think for readability and simplicity an approach like the example above would be preferable as these scenarios occur quite often for me at least.


  • Operating System: Mac OS Big Sur
  • brms Version: 2.14.4
1 Like

Hi sorry for talking time to reply to your question (which is a good one!)

Depending on your purposes, one could assume that the sample is representative of the population and thus use covariate settings according to what you have in your data, and then you only change the covariates you are interested in changing, e.g., ageyear in your case. Of course, you also this:

1 Like