Learn R Programming

lmerTest (version 2.0-33)

lmer: Fit Linear Mixed-Effects Models

Description

Fit a linear mixed model

Arguments

Value

An object of class "'>merModLmerTest"

Details

This lmer function is an overloaded function of lmer (merMod class from lme4 package).

See Also

'>merModLmerTest class

Examples

Run this code
# NOT RUN {
library(lmerTest)

## linear mixed models
fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)

# anova table the same as of class merMod but with additional F statistics and  
# p-values calculated based on Satterthwaite's approximations
anova(fm1)

# anova table the same as of class merMod but with additional F statistics and  
# p-values calculated based on Kenward-Roger's approximations
# }
# NOT RUN {
if(requireNamespace("pbkrtest", quietly = TRUE))
anova(fm1, ddf="Kenward-Roger")

# anova table the same as of class merMod
anova(fm1, ddf="lme4")
# }
# NOT RUN {
# gives summary of merModLmerTest class. The same as of class merMod but with
# additional p-values calculated based on Satterthwate's approximations
summary(fm1)

## multiple comparisons statistics. The one from lme4 package
# }
# NOT RUN {
anova(fm1, fm2)
# }

Run the code above in your browser using DataLab