Learn R Programming

lmerTest (version 2.0-6)

anova-methods: Methods for function anova in package lmerTest

Description

Methods for Function anova in Package lmerTest

Usage

## S3 method for class 'merModLmerTest':
anova(object, \dots , ddf="Satterthwaite", type=3, method.grad="simple")

Arguments

object
object of class "merModLmerTest"
...
object of class "merModLmerTest". Then the model comparison statistisc will be calculated
ddf
By default the Satterthwaite's approximation to degrees of freedom is calculated. If ddf="Kenward-Roger", then the Kenward-Roger's approximation is calculated using KRmodcomp function from pbkrtest package. If ddf="lme4" then the a
type
type of hypothesis to be tested. Could be type=3 or type=1 (The definition comes from SAS theory)
method.grad
"simple" is the default one and the fastest one. "Richardson" gives more accurate results. This argument only applies to ddf="Satterthwaite"

References

SAS Technical Report R-101 1978 Tests of Hypotheses in Fixed-Effects Linear Models Copyright (C) (SAS Institute Inc., Cary, NC, USA) Goodnight, J.H. 1976 General Linear Models Procedure (S.A.S. Institute, Inc.) Schaalje G.B., McBride J.B., Fellingham G.W. 2002 Adequacy of approximations to distributions of test Statistics in complex mixed linear models

Examples

Run this code
#import lmerTest package
library(lmerTest)

m.ham <- lmer(Informed.liking ~ Product*Information*Gender 
+ (1|Consumer), data=ham)

# type 3 anova table with  denominator degrees of freedom
# calculated based on Satterthwaite's approximation
anova(m.ham)

# type 1 anova table with denominator degrees of freedom
# calculated based on Satterthwaite's approximation
anova(m.ham, type=1)

# type3 anova table with additional F statistics and denominator degrees of freedom
# calculated based on Kenward-Roger's approximation
anova(m.ham, ddf="Kenward-Roger")

# anova table, that is returned by lme4 package
anova(m.ham, ddf="lme4")

fm2 <- lmer(Preference ~ sens2 + I(sens1^2)  +
                           (1+sens2|Consumer), data=carrots)

Run the code above in your browser using DataLab