#model with fixed effects only
fit_i1 <- brm(rating ~ treat + period + carry,
data = inhaler, family = "gaussian", WAIC = TRUE)
WAIC(fit_i1)
#model with an additional random intercept for subjects
fit_i2 <- brm(rating ~ treat + period + carry + (1|subject),
data = inhaler, family = "gaussian", WAIC = TRUE)
#compare both models
WAIC(fit_i1, fit_i2)
Run the code above in your browser using DataLab