# NOT RUN {
## import lme4 package and lmerTest package
library(lmerTest)
## specify lmer model for the sleepstudy data from the lme4 package
m <- lmer(Reaction ~ Days + (1 + Days|Subject), sleepstudy)
L <- cbind(0,1) ## specify contrast vector
calcSatterth(m, L) ## calculate F test
## specify model for the ham data
m.ham <- lmer(Informed.liking ~ Product + (1|Consumer), data = ham)
## specify contrast vector for testing product effect
L <- matrix(0, ncol = 4, nrow = 3)
L[1,2] <- L[2,3] <- L[3,4] <- 1
calcSatterth(m.ham, L)
## by using anova function we get the same result
anova(m.ham)
# }
Run the code above in your browser using DataLab