Computes the F-test for all marginal terms, i.e. terms that can be dropped from the model while respecting the hierarchy of terms in the model.
Arguments
- object
an
lmermodel fit (of class"lmerModLmerTest".)- scope
optional character vector naming terms to be dropped from the model. Note that only marginal terms can be dropped. To see which terms are marginal, use
drop.scope(terms(object)).- ddf
the method for computing the denominator degrees of freedom and F-statistics.
ddf="Satterthwaite"(default) uses Satterthwaite's method;ddf="Kenward-Roger"uses Kenward-Roger's method.ddf = "lme4"returns thedrop1table formerModobjects as defined in package lme4.- force_get_contrasts
enforce computation of contrast matrices by a method in which the design matrices for full and restricted models are compared.
- ...
currently not used.
Details
Simple marginal contrasts are used for all marginal terms unless the design
matrix is rank deficient. In that case (and if force_get_contrasts is
TRUE) the contrasts (i.e. restriction matrices on the design matrix
of the full model) are computed by comparison of the design matrices
for full and restricted models. The set of marginal terms considered for
dropping are computed using drop.scope(terms(object)).
Since all tests are based on tests of contrasts in the full model, no models are being (re)fitted.
See also
ranova for tests of marginal random terms.
Examples
# Basic usage:
fm <- lmer(angle ~ recipe + temp + (1|recipe:replicate), cake)
drop1(fm) # Using Satterthwaite degrees of freedom
#> Single term deletions using Satterthwaite's method:
#>
#> Model:
#> angle ~ recipe + temp + (1 | recipe:replicate)
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> recipe 10.3 5.15 2 42 0.2488 0.7809
#> temp 1966.7 1966.71 1 224 94.9759 <2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
if(requireNamespace("pbkrtest", quietly = TRUE))
drop1(fm, ddf="Kenward-Roger") # Alternative DenDF and F-test method
#> Single term deletions using Kenward-Roger's method:
#>
#> Model:
#> angle ~ recipe + temp + (1 | recipe:replicate)
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> recipe 10.3 5.15 2 42 0.2488 0.7809
#> temp 1966.7 1966.71 1 224 94.9759 <2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
drop1(fm, ddf="lme4", test="Chi") # Asymptotic Likelihood ratio tests
#> Single term deletions
#>
#> Model:
#> angle ~ recipe + temp + (1 | recipe:replicate)
#> npar AIC LRT Pr(Chi)
#> <none> 1708.2
#> recipe 2 1704.7 0.530 0.7672
#> temp 1 1785.7 79.531 <2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# Consider a rank-deficient design matrix:
fm <- lmer(angle ~ recipe + temp + temperature + (1|recipe:replicate), cake)
#> fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
# Here temp accounts for the linear effect of temperature, and
# temperature is an (ordered) factor that accounts for the remaining
# variation between temperatures (4 df).
drop1(fm)
#> Single term deletions using Satterthwaite's method:
#>
#> Model:
#> angle ~ recipe + temp + temperature + (1 | recipe:replicate)
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> recipe 10.189 5.094 2 42 0.2488 0.7809
#> temp
#> temperature 133.595 33.399 4 220 1.6311 0.1674
# While temperature is in the model, we cannot test the effect of dropping
# temp. After removing temperature we can test the effect of dropping temp:
drop1(lmer(angle ~ recipe + temp + (1|recipe:replicate), cake))
#> Single term deletions using Satterthwaite's method:
#>
#> Model:
#> angle ~ recipe + temp + (1 | recipe:replicate)
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> recipe 10.3 5.15 2 42 0.2488 0.7809
#> temp 1966.7 1966.71 1 224 94.9759 <2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# Polynomials:
# Note that linear terms should usually not be dropped before squared terms.
# Therefore 'Days' should not be dropped before 'I(Days^2)' despite it being
# tested here:
fm <- lmer(Reaction ~ Days + I(Days^2) + (Days|Subject), sleepstudy)
drop1(fm)
#> Single term deletions using Satterthwaite's method:
#>
#> Model:
#> Reaction ~ Days + I(Days^2) + (Days | Subject)
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> Days 4534.5 4534.5 1 114.43 6.9551 0.00952 **
#> I(Days^2) 1079.5 1079.5 1 143.00 1.6558 0.20026
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# Using poly() provides a test of the whole polynomial structure - not a
# separate test for the highest order (squared) term:
fm <- lmer(Reaction ~ poly(Days, 2) + (Days|Subject), sleepstudy)
drop1(fm)
#> Single term deletions using Satterthwaite's method:
#>
#> Model:
#> Reaction ~ poly(Days, 2) + (Days | Subject)
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> poly(Days, 2) 30974 15487 2 29.115 23.754 7.625e-07 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1