Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

name: op-test-tukey-hsd
description: Tier-2 post-hoc pairwise comparison of group means using Tukey's Honestly Significant Difference (Tukey-Kramer).
kind: operator
category: TEST
operator: TEST_TUKEY_HSD
type: reference
applies_to: process, compose, predict
examples_tags: [hypothesis-test, tier-2-test, post-hoc, k-sample, parametric, comparison, buffered-pipeline]

Tests emit statistic / p-value / effect size; no Response.Components.

Use when

After an ANOVA, compares every pair of group averages to find which ones differ, keeping the overall false-alarm rate in check.

Questions it answers:

  • Which regions differ from each other in average spend?
  • Which treatment arms have different average outcomes?

Use something else:

  • TEST_ANOVA_F when you only need to know whether any group differs.

Params

alpha is a top-level key; the rest go in params.

NameTypeDefaultDescription
alphafloat0.05Family-wise, in (0, 1).
ms_withinfloat(required)Within-group mean square from the preceding one-way ANOVA.
df_withinfloat(required)Its within-group degrees of freedom.
n_columnstringnResult-row column holding each group’s size (Tukey-Kramer weighs a pair by it).
partition_bylist—Post-test over 2+ groupers: one run per partition, the rows sharing these leading group keys (default all but the last; [] = one run).

field + split_by both required. Tier-2 only — list it in post_tests.

Inputs

field — the per-group mean (an average aggregate). split_by — the grouper key the upstream ANOVA partitioned by; a packed_bool GROUP_CATEGORY keys "0"/"1", but the test needs ≥ 3 groups (two alone is PULSE_TEST_SPLIT_GROUPS_LT_2).

Output

statistic unused (0); p_value = smallest p_adj. details: k_groups, family_alpha, ms_within, df_within, q_critical, comparisons = per pair (a < b by label) {a, b, diff, se, q, p_adj, reject_null, ci_low, ci_high}; α family-wise.

Reading the output

  • statistic: Not used: TEST_TUKEY_HSD reports no single statistic and leaves this slot at 0. Each pair’s studentized range q is in details.comparisons.
  • p_value: a p-value. Below alpha (0.05 unless the request sets another) the result is called significant; that is not the same as important, so read the effect size for how big it is.
    • Caveat: This is the smallest Tukey-adjusted p-value across all pairs, already corrected for multiple comparisons; read details.comparisons for which pairs it belongs to.

Contract

  • Weight: refused under any weight in force, an instance default included (PULSE_WEIGHT_UNSUPPORTED: it reads the aggregated per-group result rows, which carry no row weights, and weighted Tukey-Kramer has no reference form); weight: null on the slot runs it unweighted.
  • Multiplicity: already corrected for its own comparisons; a method on its own block is PULSE_MULTIPLICITY_INVALID, an inherited one skips it.
  • Streaming: buffered only.

Gotchas

  • Already family-wise: never joins a multiplicity family; an explicit non-none block is refused, an inherited one skipped.
  • Runs against materialized per-group result rows; a group row with a null drops (listwise); a non-numeric mean or n_column value is PULSE_TEST_FIELD_NOT_NUMERIC, a missing column SERVICE_VALIDATION. Buffered.
  • Consumes a one-way ANOVA’s ms_within / df_within: pass them from an earlier run’s details.
  • Assumes equal variances (as ANOVA); there is no Games-Howell.
  • Headline tracks the worst pair — inspect details.comparisons for every pair.

See