step.lmerModLmerTest: Backward Elimination for Linear Mixed Models

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/step.R

Description

Backward elimination of random-effect terms followed by backward elimination of fixed-effect terms in linear mixed models.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 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 lmerModLmerTest method an lmer model fit (of class "lmerModLmerTest".)

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.

alpha.random

alpha for random effects elimination

alpha.fixed

alpha for fixed effects elimination

reduce.fixed

reduce fixed effect structure? TRUE by default.

reduce.random

reduce random effect structure? TRUE by default.

keep

an optional character vector of fixed effect terms which should not be considered for eliminated. Valid terms are given by attr(terms(object), "term.labels"). Terms that are marginal to terms in keep will also not be considered for eliminations.

...

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# 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)

lmerTest documentation built on Oct. 23, 2020, 6:16 p.m.