I want to run a Bayesian mixed-effects logistic regression using brms to test for the evidence for/against an interaction effect. I first chose specific informative priors by running a frequentist mixed-effects logistic regression without the interaction term and taking the largest beta as an estimate of the possible magnitude of the interaction. Then I learned that any use of the data when choosing priors might be regarded as cheating. I’m now using a weakly informative prior for logistic regression recommended by Gelman et al. (2008): Cauchy(0, 10) for the intercept and Cauchy(0, 2.5) for all other fixed effects. In addition, I restrict the fixed effects to be at least 0 because my hypothesis is directional (the theory predicts a positive interaction, but also positive main effects).
Prior_positive <- c( set_prior("cauchy(0, 10)", class = "Intercept"), set_prior("cauchy(0, 2.5)", class = "b", lb = 0, coef = "") )
My model is:
bestMod <- bf(Y ~ A * B + (1 + A || item) + (1 | participant), family = "bernoulli")
To test my hypothesis, I compare a model with the interaction to a model without it:
full_brms <- brm(bestMod, prior = Prior_positive, sample_prior = "yes", iter = 1e4, cores = 4, data = mydata, save_pars = save_pars(all = TRUE), file = "bf_data_H2_full", control = list(adapt_delta = 0.99) ) null_brms <- update(full_brms, formula = ~ . - A:B, file = "bf_data_H2_null") bf10 <- brms::bayes_factor(full_brms, null_brms)
bayes_factor rather than
hypothesis because the latter is known to not work well with Cauchy priors. My questions are:
Is my choice of priors correct?
Is my code correct to calculate the Bayes Factor for the directional hypothesis
A:B > 0?
How should I set the priors if the theory predicts a positive interaction but not necessarily positive main effects (as in some cases of cross-over interaction)? I’m asking because setting a lower bound for the prior is impossible to do for the interaction term only, and setting a lower bound for all betas would be incorrect in this case.