Hi everyone!
New to the forum, first brms model.
I am triying to fit a multilevel model with random intercepts + slopes, and I am not sure how to add the splines to random efects in brms.
model<- brm(
bf( y ~ +Time + gender+ageonset +t x + Time:gender+ Time:ageonset+
(Time | ID)),
data = dat,
family = “gaussian”,
prior = c(
prior(normal( 0, 1), class = “Intercept”),
prior(normal( 1, 1), class = “b”, coef = “Timestd” ),
prior(normal(0, 1), class = “b”),
prior(exponential(1), class = “sd”),
prior(lkj(1), class = “cor”),
prior(exponential(1), class = “sigma”)),
control = list(adapt_delta = .95),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
seed = 1215)
I read in previous post you can add s(Time, ageonset, bs = “cr”, k = 10) + s(Time, gender, bs = “cr”, k = 10) but do not know how to add that to the random effects (Time | ID).
Thanks for your help.
PS = is there something about strategies for selecting priors for splines?