# emmeans v1.4.8

Monthly downloads

## Estimated Marginal Means, aka Least-Squares Means

Obtain estimated marginal means (EMMs) for many linear, generalized
linear, and mixed models. Compute contrasts or linear functions of EMMs,
trends, and comparisons of slopes. Plots and other displays.
Least-squares means are discussed, and the term "estimated marginal means"
is suggested, in Searle, Speed, and Milliken (1980) Population marginal means
in the linear model: An alternative to least squares means, The American
Statistician 34(4), 216-221 <doi:10.1080/00031305.1980.10483031>.

## Readme

# R package **emmeans**: Estimated marginal means

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

**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.Vignettes are provided on various aspects of EMMs and using the package. See the CRAN page

## Model support

The package incorporates support for many types of models, including standard models fitted using

`lm`

,`glm`

, and relatives, various mixed models, GEEs, survival models, count models, ordinal responses, zero-inflated models, and others. Provisions for some models include special modes for accessing different types of predictions; for example, with zero-inflated models, one may opt for the estimated response including zeros, just the linear predictor, or the zero model. For details, see`vignette("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 writing`recover_data`

and`emm_basis`

methods. See`vignette("extending", package = "emmeans")`

## Versions and installation

**CRAN**The latest CRAN version may be found at https://CRAN.R-project.org/package=emmeans. Also at that site, formatted versions of this package's vignettes may be viewed.**Github**To install the latest development version from Github, install the newest version (definitely 2.0 or higher) of the**devtools**package; then run

```
remotes::install_github("rvlenth/emmeans", dependencies = TRUE, build_opts = "")
### To install without vignettes (faster):
remotes::install_github("rvlenth/emmeans")
```

*Note:* If you are a Windows user, you should also first download and
install the latest version of
`Rtools`

.

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

## Functions in emmeans

Name | Description | |

contrast | Contrasts and linear functions of EMMs | |

emmeans-package | Estimated marginal means (aka Least-squares means) | |

auto.noise | Auto Pollution Filter Noise | |

extending-emmeans | Support functions for model extensions | |

emtrends | Estimated marginal means of linear trends | |

emmobj | Construct an emmGrid object from scratch | |

emmip | Interaction-style plots for estimated marginal means | |

emm_list | The emm_list class | |

str.emmGrid | Miscellaneous methods for emmGrid objects | |

emmeans | Estimated marginal means (Least-squares means) | |

oranges | Sales of oranges | |

emm | Support for multcomp::glht | |

pigs | Effects of dietary protein on free plasma leucine concentration in pigs | |

CLD | Extract and display information on all pairwise comparisons of estimated marginal means. | |

joint_tests | Compute joint tests of the terms in a model | |

hpd.summary | Summarize an emmGrid from a Bayesian model | |

make.tran | Response-transformation extensions | |

neuralgia | Neuralgia data | |

nutrition | Nutrition data | |

emmGrid-class | The emmGrid class | |

eff_size | Calculate effect sizes and confidence bounds thereof | |

rbind.emmGrid | Combine or subset emmGrid objects | |

ref_grid | Create a reference grid from a fitted model | |

feedlot | Feedlot data | |

fiber | Fiber data | |

lsmeans | Wrappers for alternative naming of EMMs | |

update.emmGrid | Update an emmGrid object | |

pwpp | Pairwise P-value plot | |

MOats | Oats data in multivariate form | |

emm_options | Set or change emmeans options | |

regrid | Reconstruct a reference grid with a new transformation or posterior sample | |

plot.emmGrid | Plot an emmGrid or summary_emm object | |

as.mcmc.emmGrid | Support for MCMC-based estimation | |

models | Models supported in emmeans | |

contrast-methods | Contrast families | |

pwpm | Pairwise P-value matrix (plus other statistics) | |

summary.emmGrid | Summaries, predictions, intervals, and tests for emmGrid objects | |

qdrg | Quick and dirty reference grid | |

xtable.emmGrid | Using xtable for EMMs | |

add_grouping | Add a grouping factor | |

as.list.emmGrid | Convert to and from emmGrid objects | |

No Results! |

## Vignettes of emmeans

## Last month downloads

## Details

Type | Package |

Date | 2020-06-26 |

URL | https://github.com/rvlenth/emmeans |

BugReports | https://github.com/rvlenth/emmeans/issues |

LazyData | yes |

ByteCompile | yes |

License | GPL-2 | GPL-3 |

Encoding | UTF-8 |

RoxygenNote | 7.1.0 |

VignetteBuilder | knitr |

NeedsCompilation | no |

Packaged | 2020-06-26 16:21:46 UTC; rlenth |

Repository | CRAN |

Date/Publication | 2020-06-26 18:20:08 UTC |

suggests | bayesplot , biglm , brms , car , coda (>= 0.17) , ggplot2 , knitr , lattice , lme4 , lmerTest (>= 2.0.32) , MASS , mediation , mgcv , multcomp , multcompView , MuMIn , nlme , ordinal (>= 2014.11-12) , pbkrtest (>= 0.4-1) , rmarkdown , rsm , scales , splines , testthat |

enhances | CARBayes , coxme , gee , geepack , MCMCglmm , MCMCpack , mice , nnet , pscl , rstanarm , sommer , survival |

imports | estimability (>= 1.3) , graphics , methods , mvtnorm , numDeriv , plyr , stats , utils , xtable (>= 1.8-2) |

depends | R (>= 3.2) |

Contributors | Henrik Singmann, Maxime HervĂ©, Jonathon Love, Paul Buerkner |

#### Include our badge in your README

```
[![Rdoc](http://www.rdocumentation.org/badges/version/emmeans)](http://www.rdocumentation.org/packages/emmeans)
```