Learn R Programming

lsr (version 1.0.0)

posthocPairwiseT: Post-hoc pairwise t-tests for ANOVA

Description

Runs pairwise t-tests for a one-way analysis of variance, with corrections for multiple comparisons.

Usage

posthocPairwiseT(x, ...)

Value

Prints a table of p-values for all pairwise group comparisons. The underlying result is also returned as a list (with the same structure as pairwise.t.test) so it can be assigned to a variable and inspected if needed.

Arguments

x

An aov object, as returned by aov. Only one-way ANOVA models are supported.

...

Additional arguments passed to pairwise.t.test, such as p.adjust.method.

Details

Takes a fitted one-way ANOVA object and runs pairwise t-tests for all pairs of groups, applying a correction for multiple comparisons. This is a simpler alternative to TukeyHSD that uses the same correction methods (e.g., Holm, Bonferroni) as pairwise.t.test.

See Also

Examples

Run this code
dataset <- data.frame(
  outcome = c(1, 2, 3, 2, 3, 4, 5, 6, 7),
  group = factor(c("a", "a", "a", "b", "b", "b", "c", "c", "c"))
)

anova1 <- aov(outcome ~ group, data = dataset)
summary(anova1)

# post-hoc pairwise comparisons with Holm correction (the default)
posthocPairwiseT(anova1)

# Bonferroni correction instead
posthocPairwiseT(anova1, p.adjust.method = "bonferroni")

Run the code above in your browser using DataLab