# New to lme4 in R - am I modeling this correctly?

Experiment: Given mice of two genetic backgrounds (normal, mutant), is there a difference in brain inflammation as determined by fluorescence intensity of an inflammatory marker?

Data: 19 mice (12 in genotype = normal, 7 in genotype = mutant) across 90 observations (3-7 observations per mouse) were analyzed.

Model (code in R):

model = lme(inflammation ~ genotype + (1|mouse))


inflammation = continuous dependent variable

genotype = categorical independent variable (binary), fixed effects

mouse = arbitrary number, random effects

Does this sound right to you?

• Have you factored the data frame? – noumenal Jul 29 '16 at 23:05
• @noumenal what do you mean ? – Robert Long Jul 31 '16 at 7:36
• Sorry for the lingo. For nominal variables it is good practice to update the data frame with as.factor: stat.ethz.ch/R-manual/R-devel/library/base/html/factor.html Also applies to ordinal vars, but see docs. – noumenal Jul 31 '16 at 9:36
• @noumenal the question is about specifying a model, not how to code variables, but I agree with your advice about checking codings, as a general matter. – Robert Long Jul 31 '16 at 11:44
• It was a comment, not an answer. – noumenal Jul 31 '16 at 16:29

However, note that the syntax your wrote is for lmer from the lme4 package, not lme from the nlme package. lme4 is more recent is preferred to nlme unless you want to model covariance structures.
The model will estimate the fixed effect of genotype while controlling for the random effect of each mouse (since measurements on the same mouse may be more alike one another than those on a different mouse).