m1 <- lmer(stigma ~ is_homeless + is_black + condition + (1 | subject), d=data)) m1 <- lmer(stigma ~ is_homeless + is_black + condition + (1 | subject), d=data)) Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack Internalm1 <- lmer(stigma ~ is_homeless + is_black + condition + (1 | subject), d=data)) m1 <- lmer(stigma ~ is_homeless + is_black + condition + (1 | subject), d=data)) m1 <- lmer(stigma ~ is_homeless + is_black + condition + (1 | subject), d=data)) m1 <- lmer(stigma ~ is_homeless + is_black + condition + (1 | subject), d=data)) The question of how to model this data is an important one, but before doing so, I want to show how the structure of the data can provide clues about the true design your study implies. Note that I assume you have only two ethnicities (black/non-black). To start, I will reiterate that the two conditions you showed are indeed between-subjects factors. I will encode these as follows:
Cond == 0 -- homeless-black / homed-white
Cond == 1 -- homeless-white / homed-black
You then have indicators for whether the target is homeless (is_homeless), whether the target is black (is_black), an interaction of these two (homeless_by_black), the subject identifier (subject), and the outcome (stigma). This is how I would set up your data:
| subject | is_homeless | is_black | homeless_by_black | condition | stigma |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 1 | 0 | 4.3 |
| 1 | 0 | 0 | 0 | 0 | 4.8 |
| 2 | 1 | 0 | 0 | 1 | 3.5 |
| 2 | 1 | 0 | 0 | 1 | 3.2 |
Some things that stick out:
As you said, each participant only sees targets that correspond to the condition they were assigned to, which means that no subject sees all conditions.
The interaction term only "turns on" for those in condition==0.
Each subject receives both a black and a non-black target and a homed and homeless target for rating.
To model this, I would lean toward a minimal model. Depending on a lot of factors (sample size, variability of the outcome, true between subjects variation in the association of interest, etc.), a maximal model is often overkill and doesn't necessarily do what its proponents claim. You can explore it, but know that you are likely run into estimation problems due to overfitting and you will have to pare down the random effect structure. I would run the following model:
m1 <- lmer(stigma ~ is_homeless + is_black + condition + (1 | subject), d=data)) This gives you mean differences in the within-subjects factors of homed/homeless, black/non-black, and the between-subjects factor of condition. The latter, as shown above, is giving you some (minimal) information about the interaction but you cannot conclude that any mean differences are solely due to this. You and others may choose to model the interaction, but I personally think it is not meaningful because it isn't a test of what you really want. Specifically, in the current design, it is not a true within-person comparison of whether viewing a homeless black target is associated with more or less stigma compared to other groups.