test.tmulti: Multiple pairwise comparisons with diagnostics

View source: R/Multi_T_test.R

test.tmultiR Documentation

Multiple pairwise comparisons with diagnostics

Description

Performs multiple pairwise comparisons using Student's t-test or Mann-Whitney test, with automatic diagnostics, effect sizes, confidence intervals, multiple testing correction and visualization.

Usage

test.tmulti(
  ...,
  comparisons = NULL,
  title = "Multiple comparisons (t / MW)",
  xlab = "",
  ylab = "Value",
  style = c("boxplot", "violin", "mono", "halfeye"),
  p_adjust = c("none", "holm", "BH", "bonferroni"),
  help = FALSE,
  verbose = TRUE
)

Arguments

...

Numeric vectors or a data.frame with groups in columns.

comparisons

List of character vectors specifying pairwise comparisons (e.g. list(c("A","B"), c("B","C"))). If NULL, all pairwise combinations are used.

title

Plot title.

xlab

X-axis label.

ylab

Y-axis label.

style

Plot style. One of "boxplot", "violin", "mono", or "halfeye".

p_adjust

Method for multiple testing correction. One of "none", "holm", "BH", "bonferroni".

help

Logical. If TRUE, prints usage examples.

verbose

Logical. If TRUE, prints results and plots.

Details

Normality is assessed using Shapiro-Wilk tests and homogeneity of variances using Levene's test. If assumptions are met, a pooled-variance t-test is used. Otherwise, the Mann-Whitney test is applied with bootstrap confidence intervals.

Effect sizes:

  • Cohen's d for t-tests

  • Rank-biserial correlation for Mann-Whitney

Value

A list with:

results

A tibble with test results.

plot

A ggplot object.

data_long

Long-format data used for plotting.

Examples

df <- data.frame(
  control   = rnorm(30, 10),
  treatment = rnorm(30, 12),
  test1     = rnorm(30, 11),
  test2     = rnorm(30, 15)
)

test.tmulti(
  df,
  comparisons = list(
    c("control", "treatment"),
    c("treatment", "test1")
  )
)


autotestR documentation built on April 29, 2026, 1:09 a.m.