Hello all,
I’m trying to fit a distributional model in brms. To start, I just want to fit a model where the mean varies by group. So I simulated some simple data using the following code with fixed values:
Int <- c(-0.5, 0, 0.5)
B <- 0.01
N <- 75
Y <- rnorm(N, mean=0, sd=0.5)
X <- runif(N, min=4, max=6.5)
Res <- 0.01
Y <- c()
CG <- c()
for (i in 1:N) {
CG[i] <- sample(Int, 1)
Y[i] <- B * X[i] + CG[i] + rnorm(1, 0, Res)
}
testdf <- data.frame(Y = Y, X = X, CG = CG)
Then I am trying to fit a simple model as shown here:
bprior <- prior(student_t(5, 0, 5), class = b) +
prior(normal(0, 0.5), class = Intercept) +
prior(cauchy(0, 2.5), class = sd)
fit <- brm( Y ~ X + ( 1 | CG ), data = testdf, prior = bprior, family = gaussian(), control = list(adapt_delta = 0.85, max_treedepth = 10) )
I thought this model matched the generating simulation, but I am getting persistent warnings about post-warmup divergences (no matter how I tweak the adapt_delta). Using brms’ default priors also yields the persistent divergences. Thus I assume the model I specified does not match the simulation above, and so I was hoping for some advice on what’s awry.
Thank you,
–Jon