Brm model finishes fitting but does not save to R object


I am trying to run the model below. The dataset is very large (n = 139027) and so I cannot upload it here for a reproducible example. E143 and E035 are ordinal variables, coop and conf are continuous, and countryISO is a factor identifying countries.

bf1 <- bf(E143 ~ mo(E035) + (mo(E035) |p| countryISO)) + cumulative()
bf2 <- bf(coop ~ conf + (conf |p| countryISO)) + gaussian()

fit <- brm(bf1 + bf2 + set_rescor(FALSE), data = d_temp,
       prior = c(prior(normal(0, 0.5), class = Intercept, resp = E143),
                 prior(normal(0, 0.5), class = b, resp = E143),
                 prior(normal(0, 0.5), class = Intercept, resp = coop),
                 prior(normal(0, 0.5), class = b, resp = coop)),
       iter = 4000, warmup = 2000, chains = 4, cores = 4,
       control = list(adapt_delta = 0.99, max_treedepth = 15),
       sample_prior = TRUE)

I am interested in the correlation between the random slopes across module formulae.

However, after all 4 chains have completed (which takes a few days), R does not save the model object. It just keeps the process going indefinitely. In the image below, I had been waiting two hours for the model object to save. I was then forced to quit R and lose all of my work.

I have never experienced this with brms before. Am I doing something wrong?


  • Operating System: macOS Mojave Version 10.14.5
  • brms Version: 2.10.0

I had that happen repeatedly when I had RStudio’s “Viewer” tab active (it was displaying an HTML table from an R Markdown document). Another (unlikely) possibility is that there’s something odd happening when R is trying to save the file to a google drive directory.

It might be helpful to try with a reproducible example where you provide a small sample dataset (fake would work with the same variable names).