Cannot add save_pars(all = TRUE) to brm() call

I cannot add save_pars(all = TRUE) to a brm() call without an error. The error I get is:

Error in formula.default(object, env = baseenv()) : invalid formula
In addition: Warning message:
Argument ‘autocor’ should be specified within the ‘formula’ argument. See ?brmsformula for help.

The model runs fine without it, but obviously I need to add it in order to compare models using add_criterion.

This issue is in part a duplicate of the issue raised by BianaS:

I have tried the solutions suggested in the thread above, but to no avail. All dependencies of arms have been updated, brms has been newly installed.


priors1 <- c(set_prior("student_t(3, 0, 2.5)", class = "Intercept"),
            set_prior("student_t(3, 0, 2.5)", class = "b", coef = "Fixed"))

#runs:
fit1 <- brm(GB020 ~ Fixed, data = GB136_GB020_compl3, family = bernoulli, iter = 20000,
            prior = priors1)

#doesn't run:
fit1 <- brm(GB020 ~ Fixed, data = GB136_GB020_compl3, family = bernoulli, iter = 20000,
            prior = priors1, save_pars(all = TRUE))

> head(GB136_GB020_compl3)
   Language_ID GB136 GB020 GB070 GB072 Glot_Family                area Fixed
1     abau1245     1     0     1     1    sepi1257  N Coast New Guinea     0
2     abee1242     1     1     0     1    atla1278    African Savannah     0
4     abkh1244     1     1     0     1    abkh1242 Greater Mesopotamia     0
7     acha1250     1     0     1     1    araw1281    NE South America     0
8     ache1245     1     0     0     0    narr1279    African Savannah     1
10    achi1256     1     1     0     0    maya1287         Mesoamerica     1
  • Operating System: MacOS 10.14.5
  • brms Version: 2.14.4

I think you need to name the argument, otherwise it’s matched positionally to be the autocor argument. So:

fit1 <- brm(GB020 ~ Fixed, data = GB136_GB020_compl3, family = bernoulli, iter = 20000,
            prior = priors1, save_pars = save_pars(all = TRUE))

Thank you so much Ax3man! Man, how blind you can get looking at code. Solved!