step.lmerModLmerTest {lmerTest} | R Documentation |
Backward Elimination for Linear Mixed Models
Description
Backward elimination of random-effect terms followed by backward elimination of fixed-effect terms in linear mixed models.
Usage
## S3 method for class 'lmerModLmerTest'
step(
object,
ddf = c("Satterthwaite", "Kenward-Roger"),
alpha.random = 0.1,
alpha.fixed = 0.05,
reduce.fixed = TRUE,
reduce.random = TRUE,
keep,
...
)
## S3 method for class 'step_list'
get_model(x, ...)
Arguments
object |
a fitted model object. For the |
ddf |
the method for computing the denominator degrees of freedom and
F-statistics. |
alpha.random |
alpha for random effects elimination |
alpha.fixed |
alpha for fixed effects elimination |
reduce.fixed |
reduce fixed effect structure? |
reduce.random |
reduce random effect structure? |
keep |
an optional character vector of fixed effect terms which should
not be considered for eliminated. Valid terms are given by
|
... |
currently not used. |
x |
a step object. |
Details
Tests of random-effects are performed using ranova
(using
reduce.terms = TRUE
) and tests of fixed-effects are performed using
drop1
.
The step method for lmer
fits has a print method.
Value
step
returns a list with elements "random"
and
"fixed"
each
containing anova-like elimination tables. The "fixed"
table is
based on drop1
and the "random"
table is
based on ranova
(a drop1
-like table for random effects). Both
tables have a column "Eliminated"
indicating the order in which terms
are eliminated from the model with zero (0
) indicating that the term
is not eliminated from the model.
The step
object also contains the final model as an attribute which
is extractable with get_model(<step_object>)
.
Author(s)
Rune Haubo B. Christensen and Alexandra Kuznetsova
See Also
drop1
for tests of marginal
fixed-effect terms and ranova
for a
drop1
-like table of reduction of
random-effect terms.
Examples
# Fit a model to the ham dataset:
fm <- lmer(Informed.liking ~ Product*Information+
(1|Consumer) + (1|Product:Consumer)
+ (1|Information:Consumer), data=ham)
# Backward elimination using terms with default alpha-levels:
(step_res <- step(fm))
final <- get_model(step_res)
anova(final)
## Not run:
# Fit 'big' model:
fm <- lmer(Informed.liking ~ Product*Information*Gender*Age +
+ (1|Consumer) + (1|Consumer:Product) +
(1|Consumer:Information), data=ham)
step_fm <- step(fm)
step_fm # Display elimination results
final_fm <- get_model(step_fm)
## End(Not run)