Description Usage Arguments Details Value Author(s) See Also Examples
Tests of vector or matrix contrasts for lmer
model fits.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  ## S3 method for class 'lmerModLmerTest'
contest(
model,
L,
rhs = 0,
joint = TRUE,
collect = TRUE,
confint = TRUE,
level = 0.95,
check_estimability = FALSE,
ddf = c("Satterthwaite", "KenwardRoger", "lme4"),
...
)
## S3 method for class 'lmerMod'
contest(
model,
L,
rhs = 0,
joint = TRUE,
collect = TRUE,
confint = TRUE,
level = 0.95,
check_estimability = FALSE,
ddf = c("Satterthwaite", "KenwardRoger", "lme4"),
...
)

model 
a model object fitted with 
L 
a contrast vector or matrix or a list of these.
The 
rhs 
righthandside of the statistical test, i.e. the hypothesized value (a numeric scalar). 
joint 
make an Ftest of potentially several contrast vectors? If

collect 
collect list of tests in a matrix? 
confint 
include columns for lower and upper confidence limits? Applies
when 
level 
confidence level. 
check_estimability 
check estimability of contrasts? Only single DF
contrasts are checked for estimability thus requiring 
ddf 
the method for computing the denominator degrees of freedom.

... 
passed to 
If the design matrix is rank deficient, lmer
drops columns for the
aliased coefficients from the design matrix and excludes the corresponding
aliased coefficients from fixef(model)
. When estimability is checked
the original rankdeficient design matrix is recontructed and therefore
L
contrast vectors need to include elements for the aliased
coefficients. Similarly when L
is a matrix, its number of columns
needs to match that of the reconstructed rankdeficient design matrix.
a data.frame
or a list of data.frame
s.
Rune Haubo B. Christensen
contestMD
for multi
degreeoffreedom contrast tests,
and contest1D
for tests of
1dimensional contrasts.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  data("sleepstudy", package="lme4")
fm < lmer(Reaction ~ Days + I(Days^2) + (1Subject) + (0+DaysSubject),
sleepstudy)
# Ftest of third coeffcients  I(Days^2):
contest(fm, c(0, 0, 1))
# Equivalent ttest:
contest(fm, L=c(0, 0, 1), joint=FALSE)
# Test of 'Days + I(Days^2)':
contest(fm, L=diag(3)[2:3, ])
# Other options:
contest(fm, L=diag(3)[2:3, ], joint=FALSE)
contest(fm, L=diag(3)[2:3, ], joint=FALSE, collect=FALSE)
# Illustrate a list argument:
L < list("First"=diag(3)[3, ], "Second"=diag(3)[1, ])
contest(fm, L)
contest(fm, L, collect = FALSE)
contest(fm, L, joint=FALSE, confint = FALSE)
contest(fm, L, joint=FALSE, collect = FALSE, level=0.99)
# Illustrate testing of estimability:
# Consider the 'cake' dataset with a missing cell:
data("cake", package="lme4")
cake$temperature < factor(cake$temperature, ordered=FALSE)
cake < droplevels(subset(cake, temperature %in% levels(cake$temperature)[1:2] &
!(recipe == "C" & temperature == "185")))
with(cake, table(recipe, temperature))
fm < lmer(angle ~ recipe * temperature + (1recipe:replicate), cake)
fixef(fm)
# The coefficient for recipeC:temperature185 is dropped:
attr(model.matrix(fm), "col.dropped")
# so any contrast involving this coefficient is not estimable:
Lmat < diag(6)
contest(fm, Lmat, joint=FALSE, check_estimability = TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.