We are implementing multilevel models in lme4 and have a question about how to handle cross-level predictors. This is a psychology experiment where individual participants come into the lab and complete multiple trials of the same task (e.g., judging how much they like a picture). To describe our dataset, we have trials nested within participants. These trials also have a trial-level predictor (e.g., how happy the participant rated they were before they made the judgment), and we might be interested in the relationship between happiness and liking (both rated on a 1-7 scale and treated as a linear variable). Modeling this with a random intercept for participant would be:
lmer(liking~happiness + (1|participant), data)
Now, in these data we also have three distinct races completing the experiment (e.g., participants that self-identify as white-only, black-only, or hispanic-only). Each participant only belongs to 1 race, and each race contains multiple participants.
We hypothesize that trial-level happiness will interact with participant-level race to predict liking. To test this model, we believe lme4 will detect that race is a group-level factor (since only one value exists for each participant) and that we would run:
lmer(liking~happiness*race + (1|participant), data)
However, based on other reading, we're wondering if this should instead be treated as a nested or random slope. For instance, should we instead use:
lmer(liking~happiness*race + (1| race/participant), data)
lmer(liking~happiness*race + (1 + happiness | race/participant), data)
Again, we are interested in the interaction between race and happiness in predicting liking, and each participant only belongs to one race. Thank you in advance for your help!
PS: We have looked at Specifying Cross-Level Interactions in LMER but this seems to represent a different data structure.