ls_means.lmerModLmerTest: LS-means for lmerTest Model Fits

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

View source: R/ls_means.R

Description

Computes LS-means or pairwise differences of LS-mean for all factors in a linear mixed model. lsmeansLT is provided as an alias for ls_means for backward compatibility.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## S3 method for class 'lmerModLmerTest'
ls_means(
  model,
  which = NULL,
  level = 0.95,
  ddf = c("Satterthwaite", "Kenward-Roger"),
  pairwise = FALSE,
  ...
)

## S3 method for class 'lmerModLmerTest'
lsmeansLT(
  model,
  which = NULL,
  level = 0.95,
  ddf = c("Satterthwaite", "Kenward-Roger"),
  pairwise = FALSE,
  ...
)

## S3 method for class 'lmerModLmerTest'
difflsmeans(
  model,
  which = NULL,
  level = 0.95,
  ddf = c("Satterthwaite", "Kenward-Roger"),
  ...
)

Arguments

model

a model object fitted with lmer (of class "lmerModLmerTest").

which

optional character vector naming factors for which LS-means should be computed. If NULL (default) LS-means for all factors are computed.

level

confidence level.

ddf

method for computation of denominator degrees of freedom.

pairwise

compute pairwise differences of LS-means instead?

...

currently not used.

Details

Confidence intervals and p-values are based on the t-distribution using degrees of freedom based on Satterthwaites or Kenward-Roger methods.

LS-means is SAS terminology for predicted/estimated marginal means, i.e. means for levels of factors which are averaged over the levels of other factors in the model. A flat (i.e. unweighted) average is taken which gives equal weight to all levels of each of the other factors. Numeric/continuous variables are set at their mean values. See emmeans package for more options and greater flexibility.

LS-means contrasts are checked for estimability and unestimable contrasts appear as NAs in the resulting table.

LS-means objects (of class "ls_means" have a print method).

Value

An LS-means table in the form of a data.frame. Formally an object of class c("ls_means", "data.frame") with a number of attributes set.

Author(s)

Rune Haubo B. Christensen and Alexandra Kuznetsova

See Also

show_tests for display of the underlying LS-means contrasts.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Get data and fit model:
data("cake", package="lme4")
model <- lmer(angle ~ recipe * temp + (1|recipe:replicate), cake)

# Compute LS-means:
ls_means(model)

# Get LS-means contrasts:
show_tests(ls_means(model))

# Compute pairwise differences of LS-means for each factor:
ls_means(model, pairwise=TRUE)
difflsmeans(model) # Equivalent.

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