Learn R Programming

lmerTest (version 3.1-3)

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

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

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

calcSatterth(model, L)

# S3 method for 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.

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).

Details

The F-value and associated p-value is for the hypothesis \(L \beta = \mathrm{rhs}\) in which rhs may be non-zero and \(\beta\) 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).

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

Run this code
# NOT RUN {
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])

# }

Run the code above in your browser using DataLab