I have some experimental data where respondents saw a random political slogan and then reported how it made them feel on a 0-10 scale across 10 emotions which theory suggests load onto three latent factors.
They look as follows:
# A tibble: 94,530 x 7
id w8 gender slogan emotion resp group
<dbl> <dbl> <fct> <fct> <fct> <ord> <fct>
1 97322 1.07 Female Get Brexit done Enthusiastic 5 Positive Affect
2 97322 1.07 Female Get Brexit done Hopeful 10 Positive Affect
3 97322 1.07 Female Get Brexit done Proud 5 Positive Affect
4 97322 1.07 Female Get Brexit done Scared 5 Anxiety
5 97322 1.07 Female Get Brexit done Worried 5 Anxiety
6 97322 1.07 Female Get Brexit done Afraid 6 Anxiety
7 97322 1.07 Female Get Brexit done Hateful 5 Aversion
8 97322 1.07 Female Get Brexit done Angry 5 Aversion
9 97322 1.07 Female Get Brexit done Bitter 5 Aversion
10 97322 1.07 Female Get Brexit done Resentful 5 Aversion
I’d like to model how varying the slogan and respondent gender affects their latent emotions.
I fit the following model to a single slogan, which seemed to work well:
brm(
formula =
bf(resp | weights(w8) ~ 1 + (1 |i| emotion) + (0 + group | id),
disc ~ 1 + (1 |i| emotion)),
family =
cumulative(
link = "probit",
link_disc = "log"),
prior =
prior(normal(0, 1), class = "Intercept") +
prior(constant(1), class = "sd", group = "id") +
prior(normal(0, 3), class = "sd", group = "emotion") +
prior(normal(0, 1), class = "sd", dpar = "disc") +
prior(lkj(2), class = "cor"),
data =
dta %>%
filter(slogan == "Get Brexit done"),
iter = 2e3,
chains = 2,
cores = 2
)
My question: How can I extend the model to handle covariates like gender
that might themselves vary over the slogan
that each respondent saw?