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")
f2. Is that true? If each individual did see all levels off2(i.e., a usual repeated-measures factor) it's not nested but you should have random slopes forf2as in:lmer(pass ~ f1 + (f2|id), family="binomial"). – Henrik Jul 18 '13 at 10:37f2. But how does it make sense to have slopes at all? All I have are categorical factors, no continuous predictors... – Jack Tanner Jul 18 '13 at 17:30f2? I have that situation. – ClarPaul Feb 04 '16 at 19:11f2(i.e., it is a between-subjects factor) simply do not model a random slope for it. If you have an more messy design you should try to see if it works with random slopes for that factor or not. It depends on the exact design then and importantly also the number of replicates. – Henrik Feb 09 '16 at 00:53