contestMD.lmerModLmerTest: Multiple Degrees-of-Freedom Contrast Tests

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

View source: R/contest.R

Description

Compute the multi degrees-of-freedom test in a linear mixed model fitted by lmer. The contrast (L) specifies a linear function of the mean-value parameters, beta. Satterthwaite's method is used to compute the denominator df for the F-test.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## S3 method for class 'lmerModLmerTest'
contestMD(
  model,
  L,
  rhs = 0,
  ddf = c("Satterthwaite", "Kenward-Roger"),
  eps = sqrt(.Machine$double.eps),
  ...
)

calcSatterth(model, L)

## S3 method for class 'lmerMod'
contestMD(
  model,
  L,
  rhs = 0,
  ddf = c("Satterthwaite", "Kenward-Roger"),
  eps = sqrt(.Machine$double.eps),
  ...
)

Arguments

model

a model object fitted with lmer from package lmerTest, i.e., an object of class lmerModLmerTest.

L

a contrast matrix with nrow >= 1 and ncol == length(fixef(model)).

rhs

right-hand-side of the statistical test, i.e. the hypothesized value. A numeric vector of length nrow(L) or a numeric scalar.

ddf

the method for computing the denominator degrees of freedom and F-statistics. ddf="Kenward-Roger" uses Kenward-Roger's method.

eps

tolerance on eigenvalues to determine if an eigenvalue is positive. The number of positive eigenvalues determine the rank of L and the numerator df of the F-test.

...

currently not used.

Details

The F-value and associated p-value is for the hypothesis L β = rhs in which rhs may be non-zero and β is fixef(model).

Note: NumDF = row-rank(L) is determined automatically so row rank-deficient L are allowed. One-dimensional contrasts are also allowed (L has 1 row).

Value

a data.frame with one row and columns with "Sum Sq", "Mean Sq", "F value", "NumDF" (numerator df), "DenDF" (denominator df) and "Pr(>F)" (p-value).

Author(s)

Rune Haubo B. Christensen

See Also

contest for a flexible and general interface to tests of contrasts among fixed-effect parameters. contest1D is a direct interface for tests of 1-dimensional contrasts.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data("sleepstudy", package="lme4")
fm <- lmer(Reaction ~ Days + I(Days^2) + (1|Subject) + (0+Days|Subject),
           sleepstudy)

# Define 2-df contrast - since L has 2 (linearly independent) rows
# the F-test is on 2 (numerator) df:
L <- rbind(c(0, 1, 0), # Note: ncol(L) == length(fixef(fm))
           c(0, 0, 1))

# Make the 2-df F-test of any effect of Days:
contestMD(fm, L)

# Illustrate rhs argument:
contestMD(fm, L, rhs=c(5, .1))

# Make the 1-df F-test of the effect of Days^2:
contestMD(fm, L[2, , drop=FALSE])
# Same test, but now as a t-test instead:
contest1D(fm, L[2, , drop=TRUE])

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