Fitting Bayesian (brms) models by a given factor + brms::update function + purrr::nest + tidy

I would like to fit some Bayesian models using brms and using the purrr::nest() function and the brms::update() function.
Assume you have a data set (dataset) with the following columns: y, By_factor, x, ID
And suppose there are say 30 unique By-factor levels, here the ID is the patient ID say.

To avoid compiling the brms code when I run each of the 30 models, I would like to use the update function.
So I would fit the first models as

mod0 <- dataset %>% filter(By_factor=="1") %>% brm(y~x+(1|ID))

Now how can I proceed to fit the other 29 models (using purrr:nest , tidy and brms::update)?

Thanks in advance,

Luwis

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.