R: Plot an 'emmGrid' or 'summary_emm' object

plot.emmGrid {emmeans} | R Documentation

## Plot an `emmGrid` or `summary_emm` object

### Description

Methods are provided to plot EMMs as side-by-side intervals, and optionally to display “comparison arrows” for displaying pairwise comparisons.

### Usage

    ## S3 method for class 'emmGrid'
    plot(x, y, type, intervals = TRUE, comparisons = FALSE,
      alpha = 0.05, adjust = "tukey", int.adjust = "none", ...)

    ## S3 method for class 'summary_emm'
    plot(x, y, horizontal = TRUE, xlab, ylab, layout, ...)

### Arguments

`x` | Object of class `emmGrid` or `summary_emm`
`y` | (Required but ignored)
`type` | Character value specifying the type of prediction desired (matching `"linear.predictor"`, `"link"`, or `"response"`). See details under `summary.emmGrid`.
`intervals` | Logical value. If `TRUE`, confidence intervals are plotted for each estimate.
`comparisons` | Logical value. If `TRUE`, “comparison arrows” are added to the plot, in such a way that the degree to which arrows overlap reflects as much as possible the significance of the comparison of the two estimates. (A warning is issued if this can't be done.)
`alpha` | The significance level to use in constructing comparison arrows
`adjust` | Character value: Multiplicity adjustment method for comparison arrows only.
`int.adjust` | Character value: Multiplicity adjustment method for the plotted confidence intervals only.
`...` | Additional arguments passed to `update.emmGrid` or `dotplot`
`horizontal` | Logical value specifying whether the intervals should be plotted horizontally or vertically
`xlab` | Character label for horizontal axis
`ylab` | Character label for vertical axis
`layout` | Numeric value passed to `dotplot`

### Details

If any `by` variables are in force, the plot is divided into separate panels. These functions use the `dotplot` function, and thus require that the lattice package be installed. For `"summary_emm"` objects, the `...` arguments in `plot` are passed only to `dotplot`, whereas for `"emmGrid"` objects, the object is updated using `...` before summarizing and plotting.

In plots with `comparisons = TRUE`, the resulting arrows are only approximate, and in some cases may fail to accurately reflect the pairwise comparisons of the estimates – especially when estimates having large and small standard errors are intermingled in just the wrong way. Note that the maximum and minimum estimates have arrows only in one direction, since there is no need to compare them with anything higher or lower, respectively.

If `adjust` or `int.adjust` are not supplied, they default to the internal `adjust` setting saved in `pairs(x)` and `x` respectively (see `update.emmGrid`).

### Examples

    warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
    warp.emm <- emmeans(warp.lm, ~ tension | wool)
    plot(warp.emm)
    plot(warp.emm, by = NULL, comparisons = TRUE, adjust = "mvt",
         horizontal = FALSE)

[Package emmeans version 1.1.3 Index]