While if you want correlated errors between all endogenous variables, you can set_rescor(TRUE), if it's only a subset, I included a solution from reading several sources at https://jebyrnes.github.io/bayesian_sem/bayesian_sem.html#correlated-error
The example:
library(palmerpenguins)
library(brms)
cor_err_bf <-
bf(bill_depth_mm ~ species + body_mass_g +
(1|dl|obs), sigma = 1) +
bf(bill_length_mm ~ species + body_mass_g +
(1|dl|obs), sigma = 1) +
set_rescor(FALSE)
corr_err_brm <- brm(cor_err_bf,
data = penguins)
sigma = 1 makes it work, but, is it correct? In comparing it to set_rescor(TRUE), the correlation or errors is different. But, that might be due to the sigma= 1?
cor_err_rescor_bf <-
bf(bill_depth_mm ~ species + body_mass_g) +
bf(bill_length_mm ~ species + body_mass_g) +
set_rescor(TRUE)
corr_err_rescor_brm <- brm(cor_err_bf,
data = penguins)
Setting sigma = 0 in the top model causes a failure of convergence. Setting it very small leads to some oddities as well.
Feels like there's something here that needs to be fixed and/or at least get the proper solution to.
While if you want correlated errors between all endogenous variables, you can
set_rescor(TRUE), if it's only a subset, I included a solution from reading several sources at https://jebyrnes.github.io/bayesian_sem/bayesian_sem.html#correlated-errorThe example:
sigma = 1 makes it work, but, is it correct? In comparing it to set_rescor(TRUE), the correlation or errors is different. But, that might be due to the sigma= 1?
Setting sigma = 0 in the top model causes a failure of convergence. Setting it very small leads to some oddities as well.
Feels like there's something here that needs to be fixed and/or at least get the proper solution to.