Hello,

Could someone please help me with the following situation? It would be great.

I’m modelling an outcome as a function of five level 1 covariates (population level) and one level 2 covariate (group level). The model is a hierarchical linear regression with cross-level interactions between the level 2 covariate and four of the five level 1 covariates. The five level 1 covariate also depend on a grouping variable, so that I have a random intercept as well as random slopes.

So far so good, everything works. The thing is that I would like to not have the correlation between certain pairs of my level 1 covariates. I would like correlations between the intercept and one level 1 covariate, two other level 1 covariates and the intercept, and between the intercept and the two last covariates: so three distinct correlation matrices.

I tried using the | ID | notation, but apparently did it wrong, as I’m getting an error message telling me that “Duplicated group-level effects are not allowed”.

Here is the model that works fine, but calculates a correlation structure among all level 1 covariates (while some of the pairs are of no interest). LMA is the level 2 covariate.

prior_brms <- c(prior(normal(0, 2), class = “Intercept”),

prior(normal(0, 2), class = “b”),

prior(normal(0, 2), class = “sd”)) # class ‘sd’ already internally has a lower bound at 0

fit_brms <- brm(formula = agr ~ var1 + var2 + var3 + var4 + var5 + LMA +

var2:LMA + var3:LMA + var4:LMA + var5:LMA +

(1 + var1 + var2 + var3 + var4 + var5 | species) +

(1 | individual) + (1 | plot) + (1 | period),

data = data2,

family = gaussian(),

prior = prior_brms,

warmup = 1000,

iter = 2000,

chains = 4,

cores = 4,

seed = 42,

control = list(adapt_delta = 0.99, max_treedepth = 15))

My (apparently poor) attempt to do what I was describing above (multiple correlation structures) was:

fit_brms_corr <- brm(formula = agr ~ var1 + var2 + var3 + var4 + var5 + LMA +

var2:LMA + var3:LMA + var4:LMA + var5:LMA +

(1 + var1 | ID1 | species) + (1 + var2 + var3 | ID2 | species) +

(1 + var4 + var5 | ID3 | species) +

(1 | individual) + (1 | plot) + (1 | period),

data = data2,

family = gaussian(),

prior = prior_brms,

…)

I would therefore like to obtain the correlation between the level 1 covariate coefficients:

- intercept and var1
- intercept, var2, var3
- intercept, var4, var5

but not var1 with any of the other level 1 covariates, nor var2 or var3 with var4 or var5.

I hope this was clear enough.

In advance thank you for any advise.

David

- Operating System: Microsoft Windows 10 Pro
- brms Version: 2.8.0