Setting a diagonal covariance matrix for random effects

I’m trying to translate a non-linear mixed-effects model from nlme to brms syntax. I think I got it except for the part that specifies random effects covariance.
Here’s the nlme version:

nlme(y~c1+a*exp(-(x^2/(2*(exp(logsigma)^2)))),
                 data = curdata,
                  fixed = a + c1 + logsigma ~ 1,
                 random = pdDiag(a + c1 + logsigma ~ 1),
                groups = ~ participant)

And here’s my take on brms syntax:

brm_hg_free_sigma_nlme<-brm(bf(y~c1+a*exp(-(x^2/(2*(exp(logsigma)^2)))), 
       c1~1+(1|participant),
       logsigma~1+(1|participant),
       a~1+(1|participant),
       nl = T),
       prior = c(prior(student_t(2, 0, 0.5), coef = "Intercept", class = "b", nlpar = "a"),
                 prior(student_t(4, 0, 3), coef = "Intercept", class = "b", nlpar = "c1")),
     data = curdata, cores = 4, save_all_pars = T, sample_prior = T, iter = 2000, warmup = 1000
     )

I see that there’s a cov_ranef parameter but I don’t understand what kind of matrix it is expecting. In vignette(“brms_phylogenetics”), the covariance matrix seems to be computed based on the data, if I understand correctly, while I simply want to set a diagonal one. Is there an easy way to do it?

1 Like

Hi,
I think the syntax 1 || participant, which avoids estimating the correlations (i.e. forces a diagonal covariance matrix) is what you need.

Does that resolve your issue?

thanks, didn’t know that || are allowed!