I am trying to use the BayestestR package to obtain BFs for pairwise contrasts; this typically works very well with linear models, but seems to not work (at least with my coding skills) for categorical or ordinal models in brms.
I use primarily for its describe_posterior which provides BF for all emmeans contrasts I specify. However, I have tried doing so with a categorical model computed in brms, and it does not seem to take the dpar argument when trying to run the sampling.
This is part of my code which may illustrate my point:
#model (with a categorical -1, 0, 1 response); Condition has two levels, and Original has 3.
m1.bias <- brm(Bias ~ Condition*Original + (1| Participant),
data = SEacc,
family = categorical(),
warmup = 2000,
iter = 40000,
save_pars = save_pars(all = TRUE),
prior = my_bias_priors,
control = list(adapt_delta = 0.9))
#the contrasts I care about - works for getting what i want w/o BFs
pw.bias.profile <- emmeans(m1.bias, specs = pairwise ~Original, point.est = median, level = .89, dpar = "mu0")
#the code I am failing to run for the BFs
describe_posterior(pw.bias.profile,
estimate = "median", dispersion = TRUE,
ci = .89, ci_method = "hdi",
test = c("bayesfactor"),
bf_prior = m1.bias,
dpar= "mu0")
#the error
Sampling priors, please wait...
Error : The select parameter is not predicted by a linear formula. Use the 'dpar' and 'nlpar' arguments to select the parameter for which marginal means should be computed.
Predicted distributional parameters are: 'mu0', 'mu1'
Predicted non-linear parameters are: ''
Error in emmeans::ref_grid(prior) :
Perhaps a 'data' or 'params' argument is needed
So I am stuck. Any help would be greatly appreciated.