ls_means.lmerModLmerTest {lmerTest} | R Documentation |
LS-means for lmerTest Model Fits
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
## 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 |
which |
optional character vector naming factors for which LS-means should
be computed. If |
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 NA
s 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
# 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.