I have a data set that looks like this toy data
library(tidyverse)
data <- tibble(ID = rep(c("Billie", "Elizabeth", "Louis"), times = 1, each = 6),
Group = c(rep("control", 12), rep("patient", 6)),
Time = rep(c("T1", "T2"), times = 3, each = 3),
Item = rep(c("a", "b", "c"), times = 6, each = 1),
answer = sample(1:7, size = 18, replace = TRUE))
There are some individual participants (ID), who can be either patient or control participants (Group). The participants take part in an experiment two times (Time). At each time, they answer three items (Item), which all measure the same construct . The answershows their answer on a 7-point-Likert-Scale (if you are not from the psychology world, the patients can have biopsies two times, and each time, three samples (items a, b, c) are taken). The research question is: does the group-membership alter the change in answers between time points / is the change in answers between the time points different for the two groups? (are the changes in biopsied tissues different for the two groups). To analyze the data, I use the brms-package.
If I wanted an easy life, I would just calculate the average answer per person and time point and continue from there.
easy <- data %>%
group_by(ID, Time) %>%
summarize(Group = unique(Group),
mean_ans = mean(answer))
To analyze with brms, my formula would then be
bf(mean_answer ~ 1 + Group * Time + (1|ID))
(At least I hope so...)
But life is nicer when it's complicated, so my question is: how can I specify a brms-formula that allows me to include the item-level information that is present in my data? I think what I would like to write is something like this
bf(answer ~ 1 + Group * Time + (1 | Item|Time|ID))
Reading into crossed and nested random effects here and here, I was under the impression that my data are crossed, leading to the following formula:
bf(answer ~ 1 + Group * Time + (1+ ID) + (1|Time) + (1|Item))
But does this formula take into account the correlation structure of my data?
Moving on, following this paper, I was under the impression that my data are the "crossed and nested" part of the figure. Following this track, at the end of this site is a guide as to how to specify this case in lme4, but I have a hard time translating this into brms formulas. Finally, i found this great site on country-year panel data, which I am currently exploring, but I am having a hard time translating the scenarios there to my case. I would greatly appreciate any help in this. Thank you already in advance!