# Nesting fixed effects within random effect in lmer in R

I am a masters student in phonetics currently looking at voice onset time values (VOT) for voiced consonants in French.

I am intending to use a linear mixed effects regression to evaluate the effect of 4 fixed effects on the length of the VOT (in milliseconds - dependant variable): gender, city, consonant and vowel. I have two random effects which I believe are crossed: speaker and word. There is (except for some missing values) a VOT value for each word for each speaker.

Here is an example of the data structure (values are fictitious):

SPEAKER CITY    GENDER  WORD    CONSONANT   VOWEL   VOT
A       Q       M       be      b           e       -190
A       Q       M       bi      b           i       -200
A       Q       M       de      d           e       -170
A       Q       M       da      d           a       -180
A       Q       M       go      g           o       -250
A       Q       M       ga      g           a       -270
B       C       F       be      b           e       -195
B       C       F       bi      b           i       -205
B       C       F       de      d           e       -175
B       C       F       da      d           a       -185
B       C       F       go      g           o       -265
B       C       F       ga      g           a       -240


Every speaker says every word (I believe SPEAKER and WORD are crossed random effects), which are combinations of a stop consonant and a French vowel. Those words begin by different voiced consonants (b, d, or g) and contain different vowels, which partly vary accross consonants (there can be an i following b and d, but not g, and so on). My understanding is that the fixed effects CONSONANT and VOWEL are respectively nested within WORD and CONSONANT.

I am trying to create 3 models to later compare using the anova() function to perform a likelihood ratio test and to select the best model for the data. The first model is a null one, including only random effects; the second one should include random effects plus all fixed effects without interactions; the last one should include all possible interactions and main effects (maximal model). Here is what I've got so far (but I am almost sure this is almost entirely wrong):

#Null model
vot.null <- lmer(VOT ~ 1 + (1|SPEAKER) + (1|WORD), data=expe)

#Model with only fixed effects
vot.fixed <- lmer(VOT ~ GENDER + CITY + CONSONANT + VOWEL + (1|SPEAKER) + (1|WORD), data=expe)

#Maximal model
vot.maximal<- lmer(VOT~ GENDER*CITY + (1|SPEAKER) + (1|WORD/CONSONANT/VOWEL), data=expe)


It does not seem to work, however, since if I show the random intercepts with the ranef() function, I see that lme4 has computed one for each combination of CONSONANT:VOWEL:WORD. What I would like to accomplish is creating a maximal model in which all possible interactions and main effects for the fixed factors GENDER, CITY, CONSONANT and VOWEL are accounted for, while keeping two random effects for SPEAKER and WORD.

I am not interested in random slopes, only in random intercepts. How should I go about this nesting problem?

• I am not interested in random slopes, only in random intercepts. - You are interested in random slopes (based on your description of what you want to achieve). I am guessing that you misunderstand what "random slope" would mean in this situation. – amoeba Dec 8 '16 at 9:40