I just fit a model in lme4, and I'm wondering what the heck I fit...
I have individuals id
, and each is measured pass/fail on items that can be described using two factors, f1
and f2
. My theory says that id
and f2
can interact. So I want to compare these models:
# f2 doesn't matter
m1 <- lmer(pass ~ f1 + (1|id), family="binomial")
# f2 is a fixed effect, doesn't interact with individuals
m2 <- lmer(pass ~ f1 + f2 + (1|id), family="binomial")
# f2 is a nested random effect, interacting with individuals
m3 <- lmer(pass ~ f1 + (1|f2/id), family="binomial")
First, am I right that there's a random effect of each level of f2, and each individual's level of f2 is partially pooled, depending on the number of observations for that individual?
Second, does it make sense to fit f2
as a fixed effect with random individuals nested within each level of f2
? How does one write that?
Third, what's this, with f2 and id reversed in the formula? I typed it by accident, but now I want to understand it.
m3weird <- lmer(pass ~ f1 + (1|id/f2), family="binomial")