anova_r4vn: One-way ANOVA with Bartlett Test

anovaiR Documentation

One-way ANOVA with Bartlett Test

Description

anovai() reconstructs one-way ANOVA from c(n, mean, sd) summaries. anova() analyzes a numeric variable by a grouping variable. Bartlett's test of equal variances is included by default. When the first argument is a fitted model, the call is delegated to stats::anova(). For one-way ANOVA, posthoc can request Tukey, Games-Howell, Scheffe, Bonferroni, or other multiplicity-adjusted pairwise comparisons. Eta-squared and omega-squared remain reported by the ANOVA engine. Hierarchical by = vars(...) is supported for data-based ANOVA.

Usage

anovai(
  ...,
  group.names = NULL,
  bartlett = TRUE,
  level = 0.95,
  posthoc = c("none", "tukey", "games-howell", "scheffe", "bonferroni", "pairwise"),
  adjust = "holm",
  digits = 3,
  p_digits = 3,
  show = TRUE,
  console = FALSE
)

anovai(
  ..., group.names = NULL, bartlett = TRUE, level = 0.95,
  posthoc = c("none", "tukey", "games-howell", "scheffe", "bonferroni", "pairwise"),
  adjust = "holm", digits = 3, p_digits = 3, show = TRUE, console = FALSE
)

anova(
  object, ..., by = NULL, data = NULL, bartlett = TRUE, level = 0.95,
  posthoc = c("none", "tukey", "games-howell", "scheffe", "bonferroni", "pairwise"),
  adjust = "holm", digits = 3, p_digits = 3, show = TRUE, console = FALSE
)

anova(
  object,
  ...,
  by = NULL,
  data = NULL,
  bartlett = TRUE,
  level = 0.95,
  posthoc = c("none", "tukey", "games-howell", "scheffe", "bonferroni", "pairwise"),
  adjust = "holm",
  digits = 3,
  p_digits = 3,
  show = TRUE,
  console = FALSE
)

Arguments

...

For anovai(), group summaries c(n, mean, sd). For a fitted model, additional objects or arguments passed to stats::anova().

group.names

Optional names for the summarized groups.

bartlett

Include Bartlett's test of equal variances.

level

Confidence level for group means.

posthoc

Post-hoc method: "none", "tukey", "games-howell", "scheffe", "bonferroni", or "pairwise". Games-Howell is useful when equal-variance assumptions are doubtful. posthoc = "bonferroni" provides Bonferroni-adjusted p-values and simultaneous confidence intervals.

adjust

Multiplicity adjustment used by posthoc = "pairwise"; any method accepted by stats::p.adjust() may be used.

digits, p_digits

Decimal places for estimates and p-values.

show

Logical; open the formatted result in the Viewer. Default TRUE.

console

Logical; also print the traditional text result in the Console. Default FALSE.

object

Numeric outcome variable or a fitted model object.

by

Grouping variable for one-way ANOVA. by = vars(region, sex, group) uses region and sex as nested strata and group as the ANOVA factor.

data

Data frame. If NULL, active data is used.

Value

A r4vn_stat object for one-way ANOVA, or the ordinary result from stats::anova() for fitted models.

Examples

anovai(c(n = 20, mean = 10, sd = 2),
       c(n = 25, mean = 15, sd = 4),
       c(n = 18, mean = 13, sd = 3), posthoc = "bonferroni")

d <- data.frame(score = c(10,12,11,18,17,20,25,24,27),
                treatment = factor(rep(c("A","B","C"), each = 3)))
anova(score, by = treatment, data = d, posthoc = "games-howell")


R4VN documentation built on Sept. 30, 2026, 5:13 p.m.