**How does estimating residual correlations affect model fitting?**

Does setting set_rescor(TRUE) change how effects are fit? In a simple multivariate model, it has no effect (left-side models in output plots).

However, with a horseshoe prior on *b*, set_rescor(TRUE) has a large impact on the modelled effects (right-side models in output plots).

- Operating System: Ubuntu 20.10
- brms Version: version 2.15.0

```
require(brms)
require(ggpubr)
n <- 18
set.seed(21)
dat <- tibble( Group = rep(rep(0:1,each=n/2),2),
res1 = rnorm( 2*n, 0, 1 ),
res2 = rnorm( 2*n, 0, 1 ),
res3 = rnorm( 2*n, 0, 1 ),
res4 = rnorm( 2*n, 0, 1 ) ) %>%
mutate( y1 = Group + res1,
y2 = Group + y1 + res2,
y3 = y2 + res3,
y4 = y1 + y2 + y3 + res4,
y1 = (y1 - mean(y1))/sd(y1),
y2 = (y2 - mean(y2))/sd(y2),
y3 = (y3 - mean(y3))/sd(y3),
y4 = (y4 - mean(y4))/sd(y4),
Group = factor(Group) ) %>%
as.data.frame
#************************************************************************************
#* USING BRMS
#************************************************************************************
bf0 <- bf( mvbind(y1,y2,y3,y4) ~ Group) + set_rescor(FALSE)
bf1 <- bf( mvbind(y1,y2,y3,y4) ~ Group) + set_rescor(TRUE)
b_priors <- c( set_prior('horseshoe(1)', class='b', resp='y1'),
set_prior('horseshoe(1)', class='b', resp='y2'),
set_prior('horseshoe(1)', class='b', resp='y3'),
set_prior('horseshoe(1)', class='b', resp='y4') )
brms_0_0 <- brm( bf0,
control = list(adapt_delta=0.99),
cores = 4,
seed = 1,
data = dat )
brms_1_0 <- brm( bf1,
control = list(adapt_delta=0.99),
cores = 4,
seed = 1,
data = dat )
# regularization
brms_0_1 <- brm( bf0,
prior = b_priors,
control = list(adapt_delta=0.999),
cores = 4,
seed = 1,
data = dat )
brms_1_1 <- brm( bf1,
prior = b_priors,
control = list(adapt_delta=0.999),
cores = 4,
seed = 1,
data = dat )
ggarrange( mcmc_plot(brms_0_0) + coord_cartesian(xlim=c(-1.5,1.5)),
mcmc_plot(brms_0_1) + coord_cartesian(xlim=c(-1.5,1.5)),
mcmc_plot(brms_1_0) + coord_cartesian(xlim=c(-1.5,1.5)),
mcmc_plot(brms_1_1) + coord_cartesian(xlim=c(-1.5,1.5)), ncol=2, nrow=2)
```