Learn R Programming

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

R package lsmeans: Least-squares means (predicted marginal means)

Features

  • For an overview, see the vignette -- also available via vignette("using-lsmeans", package = "lsmeans")
  • Least-squares means (a.k.a. predicted marginal means) are derived by using a model to make predictions over a regular grid of pridictor 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 lsmeans 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 LS means, 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 lstrends 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 genearalized 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="lsmeans")
  • 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 lsmeans support for their models by providing recover.data and lsm.basis methods. See vignette("extending", package = "lsmeans")

Installation

  • To install latest version from CRAN, run
install.packages("lsmeans")

Release notes for the latest CRAN version are found at https://CRAN.R-project.org/package=lsmeans/NEWS -- or do news(package = "lsmeans") for notes on the version you have installed.

  • To install the latest development version from Github, have the newest devtools package installed, then run
devtools::install_github("rvlenth/lsmeans", dependencies = TRUE)

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

Copy Link

Version

Install

install.packages('lsmeans')

Monthly Downloads

8,830

Version

2.27-2

License

GPL-2 | GPL-3

Maintainer

Russell Lenth

Last Published

August 28th, 2017

Functions in lsmeans (2.27-2)

lsmeans-package

Least-squares means
lsmeans

Least-squares means (or predicted marginal means)
fiber

Fiber data
glht

lsmeans support for glht
cld

Compact letter display of pairwise comparisons
contrast

Methods for obtaining analyses ref.grid and lsmobj objects
MOats

Oats data in multivariate form
auto.noise

Auto Pollution Filter Noise
recover.data

Support functions for creating a reference grid
feedlot

Feedlot data
lsmip

Least-squares (predicted marginal) means interaction plot
make.tran

Response transformations
oranges

Orange sales
ref.grid

Create a reference grid from a fitted model
models

Models supported in lsmeans
nutrition

Nutrition data
ref.grid-class

Classes "ref.grid" and "lsmobj"
pairwise.lsmc

Contrast families
summary

Methods for ref.grid objects
update

Set or retrieve options for objects and summaries in lsmeans