Learn R Programming

⚠️There's a newer version (1.11.2-8) of this package.Take me there.

R package emmeans: Estimated marginal means (least-squares means)

Note

emmeans is a continuation of the package lsmeans. The latter will eventually be retired.

Features

Estimated marginal means (EMMs, previously known as least-squares means in the context of traditional regression models) are derived by using a model to make predictions over a regular grid of predictor combinations (called a reference grid). These predictions may possibly be averaged (typically with equal weights) over one or more of the predictors. Such marginally-averaged predictions are useful for describing the results of fitting a model, particularly in presenting the effects of factors. The emmeans package can easily produce these results, as well as various graphs of them (interaction-style plots and side-by-side intervals).

  • Estimation and testing of pairwise comparisons of EMMs, and several other types of contrasts, are provided. There is also a cld method for display of grouping symbols.

  • Two-way support of the glht function in the multcomp package.

  • For models where continuous predictors interact with factors, the package's emtrends function works in terms of a reference grid of predicted slopes of trend lines for each factor combination.

  • Incorporates support for many types of models, including those in stats package (lm, glm, aov, aovlist), linear and generalized linear mixed models (e.g., nlme, lme4, afex), ordinal-response models (e.g., ordinal, MASS), survival analysis (e.g., survival, coxme), generalized estimating equations (gee, geepack), and others. See help("models", package = "emmeans")

  • Various Bayesian models (carBayes, MCMCglmm, MCMCpack) are supported by way of creating a posterior sample of least-squares means or contrasts thereof, which may then be examined using tools such as in the coda package.

  • Package developers may provide emmeans support for their models by providing recover_data and emm_basis methods. See vignette("extending", package = "emmeans")

  • To install the latest development version from Github, have the newest devtools package installed, then run

devtools::install_github("rvlenth/emmeans", dependencies = TRUE,
                        build_vignettes = TRUE)

For latest release notes on this development version, see the NEWS file

Copy Link

Version

Install

install.packages('emmeans')

Monthly Downloads

160,851

Version

1.0

License

GPL-2 | GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Russell Lenth

Last Published

December 5th, 2017

Functions in emmeans (1.0)

emm_list

The emm_list class
MOats

Oats data in multivariate form
add_grouping

Add a grouping factor
contrast-methods

Contrast families
emmGrid-class

The emmGrid class
str.emmGrid

Miscellaneous methods for emmGrid objects
cld.emmGrid

Extract and display information on all pairwise comparisons of least-squares means.
emmeans

Estimated marginal means (Least-squares means)
contrast

Contrasts and linear functions of EMMs
as.emmGrid

Convert to and from emmGrid objects
emmip

Interaction-style plots for estimated marginal means
auto.noise

Auto Pollution Filter Noise
ref.grid

Deprecated functions and arguments from lsmeans
fiber

Fiber data
emmobj

Construct an emmGrid object from scratch
emtrends

Estimated marginal means of linear trends
emm

Support for multcomp::glht
extending-emmeans

Support functions for model extensions
models

Models supported in emmeans
rbind.emmGrid

Combine or subset emmGrid objects
feedlot

Feedlot data
make.tran

Response-transformation extensions
emmeans-package

Estimated marginal means (aka Least-squares means)
nutrition

Nutrition data
oranges

Sales of oranges
ref_grid

Create a reference grid from a fitted model
update.emmGrid

Set or retrieve options for objects and summaries
lsmeans

Wrappers for alternative naming of EMMs
neuralgia

Neuralgia data
xtable.emmGrid

Using xtable for EMMs
pigs

Effects of dietary protein on free plasma leucine concentration in pigs
plot.emmGrid

Plot an emmGrid or summary_emm object
as.mcmc.emmGrid

Support for MCMC-based estimation
regrid

Reconstruct a reference grid with a new transformation
summary.emmGrid

Summaries, predictions, intervals, and tests for emmGrid objects