With the following code, it works for me:

```
# covariance matrix of outcomes
cor_matrix <- function(x, r, v = rep(1, length(x)), na.rm = FALSE) {
mat <- diag(v)
se <- sqrt(v)
se[is.na(se)] <- 0
if (length(x) > 1L) {
for (i in 2:nrow(mat)) {
for (j in 1:(i-1)) {
if (x[i] == x[j]) {
mat[i, j] <- mat[j, i] <- r * se[i] * se[j]
}
}
}
}
dimnames(mat) <- list(1:nrow(mat), 1:ncol(mat))
if (na.rm) {
keep <- !is.na(diag(mat))
mat <- mat[keep, keep]
}
mat
}
effect_coding <- function(x, levels) {
# convenience function for effect (i.e. sum) coding
x <- factor(x, levels = levels)
contrasts(x) <- contr.sum(length(levels))
colnames(contrasts(x)) <- levels[-length(levels)]
x
}
dat <- data.frame(
yi = rnorm(20),
level = factor(rep(0:1, each = 10)),
log_time = rnorm(20),
exer = rnorm(20),
study_ID = 1:20,
vi = 0.25
)
prior <-c(prior(normal(0, 100), class = Intercept),
prior(normal(0, 10), class = b),
prior(cauchy(0, 10), class = sd))
v.m1 <- cor_matrix(dat$study_ID, r = 0.9, v = dat$vi)
cor_obs <- cor_matrix(dat$study_ID, r = 0.9)
# brms 2.11.6
m1 <- brm(bf(
yi ~ 1 + log_time + level + exer + (1|study_ID) + fcor(v.m1),
sigma = 1
),
family = gaussian(),
prior = prior, chains = 1,
data2 = list(v.m1 = v.m1),
control = list(adapt_delta = 0.99), data = dat)
conditions1 <- data.frame(level = 1)
plot(conditional_effects(m1, effects = "log_time:exer",
conditions = conditions1))
```