Hi BRMS community! I am not sure if this is the right forum for a question like this, so if not please let me know - I’ve been stuck for awhile and my brain is taxed! Any help appreciated.
I have a dataset of measurements from pairs of conversation partners.
- One of the measures is, “How much did you like the person you talked to?” (
i_like_you, a 1-7 scale)
- Another measure is “How much do you think they liked you?” (
i_think_you_like_me, also 1-7)
- There’s a term,
you_actually_like_mewhich in the real data is really just your partner’s
- Finally, we have a measure of how much each person enjoyed the conversation (
I’ve made a toy dataset in which every
speaker_id has two conversations, each with a different partner.
library(tidyverse) set.seed(1L) n <- 40 data <- tibble( convo_id = 1:n, speaker_id = rep(LETTERS[1:20], 2), partner_id = c(LETTERS[11:20], LETTERS[1:10], LETTERS[20:11], LETTERS[10:1]), i_like_you = sample(1:7, n, replace = TRUE), i_think_you_like_me = sample(1:7, n, replace = TRUE), you_actually_like_me = sample(1:7, n, replace = TRUE), enjoyment = sample(1:7, n, replace = TRUE) ) |> arrange(speaker_id)
The data look like this:
data |> head() # A tibble: 6 × 7 convo_id speaker_id partner_id i_like_you i_think_you_like_me you_actually_like_me enjoyment <int> <chr> <chr> <int> <int> <int> <int> 1 1 A K 4 5 4 2 2 21 A T 7 3 3 7 3 2 B L 7 7 1 6 4 22 B S 7 3 7 4 5 3 C M 5 2 7 5 6 23 C R 6 1 1 6
*Note: This toy example is not representative in that
you_actually_like_me are not mirrored between conversation partners. But for the sake of the modeling question I don’t think this matters.
My goal is to model the impact of the gap between
you_actually_like_me, on enjoyment (let’s call this
The challenge I’m running into is that I want to take into account the fact that each person has some latent overall bias towards liking people in general (let’s call this
liking_bias), as well as some latent bias related to how much they think people like them in general (
In other words, in our own conversation, I want to be able to estimate the degree to which
enjoyment, above and beyond the degree to which latent
To complicate things further, it’s likely that the relationship between these predictors and
enjoyment is curvilinear - there’s some kind of sweet spot (probably quadratic) that corresponds with maximum enjoyment.
I think I should be able to model this as a Bayesian hierarchical model, grouped by individual, with each individual having parameters for
perception_bias, and linear and squared terms for
you_actually_like_me, plus their interaction (which I think would basically represent
liking_gap without resorting to computing a difference score).
I started following Scott Claessen’s tutorial on how to model latent variables with BRMS, but I got confused trying to figure out how to translate his syntax, which specifies latent variables with
mi() and multiple columns, into my structure, which is thinking of multiple observations from the same column as being the emission states of the latent variable.
I think a problem like this would usually be solved with SEM, but after having a look at
blavaan and reading through this
brms Github thread on the gradual development of SEM-style support, I got a little overwhelmed and so thought I’d just ask for help.
Thank you again for any help anyone can offer to this