Sure, a little long but here I post a mock data frame and then an example model, with the brms regression also coded. I basically made it here so that Group B generally scores higher than Group A, and also that Condition 2 is higher than Condition 1.
I am predicting score from Group, Condition, and their interaction. I also have a distributional component where I predict phi just based on Group.
mockdata ← data.frame(score = c(0.5, 0.42, 0.58, 0.52, 0.53, 0.54,
0.5, 0.40, 0.53, 0.525, 0.503, 0.5,
0.48, 0.32, 0.48, 0.62, 0.43, 0.58,
0.5, 0.42, 0.58, 0.52, 0.53, 0.46,
0.5, 0.40, 0.53, 0.525, 0.503, 0.5,
0.55, 0.50, 0.58, 0.53, 0.70, 0.5,
0.58, 0.48, 0.50, 0.52, 0.513, 0.6,
0.56, 0.41, 0.5, 0.65, 0.57, 0.7,
0.55, 0.50, 0.63, 0.58, 0.6, 0.61,
0.7, 0.50, 0.50, 0.55, 0.59, 0.61,
0.7, 0.55, 0.65, 0.8, 0.73, 0.6,
0.6, 0.55, 0.8, 0.63, 0.5, 0.504,
0.6, 0.5, 0.8, 0.75, 0.58, 0.5,
0.59, 0.52, 0.72, 0.80, 0.5, 0.5,
0.59, 0.60, 0.53, 0.625, 0.75, 0.8,
0.7, 0.7, 0.7, 0.79, 0.85, 0.8,
0.62, 0.5, 0.89, 0.75, 0.6, 0.59,
0.9, 0.7, 0.92, 0.7, 0.75, 0.635,
0.8, 0.67, 0.9, 0.9, 0.55, 0.45,
0.79, 0.75, 0.5, 0.7, 0.89, 0.89
),
group = c("A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A",
"B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B"),
condition = c("Cond1", "Cond1", "Cond1", "Cond1", "Cond1", "Cond1",
"Cond1", "Cond1", "Cond1", "Cond1", "Cond1", "Cond1",
"Cond1", "Cond1", "Cond1", "Cond1", "Cond1", "Cond1",
"Cond1", "Cond1", "Cond1", "Cond1", "Cond1", "Cond1",
"Cond1", "Cond1", "Cond1", "Cond1", "Cond1", "Cond1",
"Cond2", "Cond2", "Cond2", "Cond2", "Cond2", "Cond2",
"Cond2", "Cond2", "Cond2", "Cond2", "Cond2", "Cond2",
"Cond2", "Cond2", "Cond2", "Cond2", "Cond2", "Cond2",
"Cond2", "Cond2", "Cond2", "Cond2", "Cond2", "Cond2",
"Cond2", "Cond2", "Cond2", "Cond2", "Cond2", "Cond2",
"Cond1", "Cond1", "Cond1", "Cond1", "Cond1", "Cond1",
"Cond1", "Cond1", "Cond1", "Cond1", "Cond1", "Cond1",
"Cond1", "Cond1", "Cond1", "Cond1", "Cond1", "Cond1",
"Cond1", "Cond1", "Cond1", "Cond1", "Cond1", "Cond1",
"Cond1", "Cond1", "Cond1", "Cond1", "Cond1", "Cond1",
"Cond2", "Cond2", "Cond2", "Cond2", "Cond2", "Cond2",
"Cond2", "Cond2", "Cond2", "Cond2", "Cond2", "Cond2",
"Cond2", "Cond2", "Cond2", "Cond2", "Cond2", "Cond2",
"Cond2", "Cond2", "Cond2", "Cond2", "Cond2", "Cond2",
"Cond2", "Cond2", "Cond2", "Cond2", "Cond2", "Cond2"))
mockmodel ← (bf(score ~ 1 + group + condition + group:condition)) +
lf(phi ~ 0 + group)
library(brms)
mockbetareg ← brm(mockmodel,
data = mockdata,
family = Beta(),
control = list(adapt_delta = 0.8, max_treedepth = 10),
chains = 4,
cores = 4,
iter = 8000,
warmup = 2000)
mockbetareg
get_prior(mockmodel,
data = mockdata,
family = Beta(),
control = list(adapt_delta = 0.8, max_treedepth = 10),
chains = 4,
cores = 4,
# inits = 0,
iter = 8000,
warmup = 2000)
In essence then, my question is simply how to place some meaningful priors on the components of the model. I am not new to working with priors in general - I’ve done it succesfully and I think quite nicely with normally distributed data. But I don’t want to dive in on this sort of data and make a mistake/not understand what I’m doing - so your help is much appreciated!