I’m trying to tune the priors for a multivariate longitudinal model as part of prior predictive checking. However, I’m finding this a very difficult process. Here’s a toy univariate example however using the sleepstudy dataset from the lmer
package:
library(lme4)
library(brms)
fit_prior <- brm(
Reaction ~ Days + (Days | Subject),
data = sleepstudy, chains=4,
prior = c(set_prior("normal(0, 10)", class = "b")),
sample_prior = "only")
> prior_summary(fit_prior)
prior class coef group resp dpar nlpar bound source
normal(0, 10 b user
normal(0, 10 b Days (vectorized)
student_t(3, 288.7, 59.3) Intercept default
lkj_corr_cholesky(1) L default
lkj_corr_cholesky(1) L Subject (vectorized)
student_t(3, 0, 59.3) sd default
student_t(3, 0, 59.3) sd Subject (vectorized)
student_t(3, 0, 59.3) sd Days Subject (vectorized)
student_t(3, 0, 59.3) sd Intercept Subject (vectorized)
student_t(3, 0, 59.3) sigma default
pp_check(fit_prior, ndraws = 200)
This will typically give me a PPC like so:
So, maybe this is ok, but its exploring a very wide space for the response variable, and I don’t expect Y to ever be negative. So I’ll try being alot more informative about sigma and sd:
fit_prior2 <- brm(
Reaction ~ Days + (Days | Subject),
data = sleepstudy, chains=4,
prior = c(set_prior("normal(0, 10)", class = "b"),
set_prior("student_t(3, 0, 1)", class = "sigma"),
set_prior("student_t(3, 0, 5)", class = "sd")),
sample_prior = "only")
pp_check(fit_prior2, ndraws = 200)
Is this actually better? I’m not really sure. Yes it tends less to negative values, but now each line is very narrowly up and down and none look close to the shape of the real y. Can anyone advise here? I’ve been playing with it for some time varying any prior I can find, but never seem to get it quite right.