Learn R Programming

emmeans (version 1.10.5)

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

Description

This function presents results from emmeans and pairwise comparisons thereof in a compact way. It displays a matrix (or matrices) of estimates, pairwise differences, and P values. The user may opt to exclude any of these via arguments means, diffs, and pvals, respectively. To control the direction of the pairwise differences, use reverse; and to control what appears in the upper and lower triangle(s), use flip. Optional arguments are passed to contrast.emmGrid and/or summary.emmGrid, making it possible to control what estimates and tests are displayed.

Usage

pwpm(emm, by, reverse = FALSE, pvals = TRUE, means = TRUE,
  diffs = TRUE, flip = FALSE, digits, ...)

Value

A matrix or `list` of matrices, one for each `by` level.

Arguments

emm

An emmGrid object

by

Character vector of variable(s) in the grid to condition on. These will create different matrices, one for each level or level-combination. If missing, by is set to emm@misc$by.vars. Grid factors not in by are the primary factors: whose levels or level combinations are compared pairwise.

reverse

Logical value passed to pairs.emmGrid. Thus, FALSE specifies "pairwise" comparisons (earlier vs. later), and TRUE specifies "revpairwise" comparisons (later vs. earlier).

pvals

Logical value. If TRUE, the pairwise differences of the EMMs are included in each matrix according to flip.

means

Logical value. If TRUE, the estimated marginal means (EMMs) from emm are included in the matrix diagonal(s).

diffs

Logical value. If TRUE, the pairwise differences of the EMMs are included in each matrix according to flip.

flip

Logical value that determines where P values and differences are placed. FALSE places the P values in the upper triangle and differences in the lower, and TRUE does just the opposite.

digits

Integer. Number of digits to display. If missing, an optimal number of digits is determined.

...

Additional arguments passed to contrast.emmGrid and summary.emmGrid. You should not include method here, because pairwise comparisons are always used.

See Also

A graphical display of essentially the same results is available from pwpp

Examples

Run this code
warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
warp.emm <- emmeans(warp.lm, ~ tension | wool)

pwpm(warp.emm)

# use dot options to specify noninferiority tests
pwpm(warp.emm, by = NULL, side = ">", delta = 5, adjust = "none")

Run the code above in your browser using DataLab