Hi everybody, I’m trying to estimate a model in which I allow not just for different random intercepts of sub-populations (fit1 below) but also random slopes (fit2 below):
df <- data.frame(y = rnorm(1000),
x = rnorm(1000),
g = as.factor(rep(1:20,each=50)),
f = as.factor(rep(c('a','b'),each=500)))
fit1 <- brm(y ~ 1 + (1|gr(g,by=f)),
data = df, chains = 1)
fit2 <- brm(y ~ 1 + (x|gr(g,by=f)),
data = df, chains = 1)
fit1 runs fine but fit2 crashes. What am I doing wrong? Thanks for your help!