Several me() terms model their latent (noise-free)
values as correlated by default, which is brms's default too. Add
set_mecor(FALSE) to a formula to model them as independent.
Arguments
- mecor
TRUE(the default) to estimate the correlation between the latent values of theme()terms that share a grouping,FALSEto fix it at zero.
Examples
set.seed(3)
n <- 120
tx <- rnorm(n)
tz <- 0.6 * tx + rnorm(n, 0, 0.8)
d <- data.frame(x = tx + rnorm(n, 0, 0.3), z = tz + rnorm(n, 0, 0.3),
sx = 0.3, sz = 0.3)
d$y <- 1 + 0.5 * tx - 0.4 * tz + rnorm(n, 0, 0.5)
# independent latent values
f0 <- bf(y ~ me(x, sx) + me(z, sz)) + set_mecor(FALSE)
fit0 <- frm(f0, data = d)
# correlated latent values, with an lkj() prior on the correlation
fit1 <- frm(bf(y ~ me(x, sx) + me(z, sz)), data = d,
prior = set_prior("lkj(2)", class = "corme"))