ForHosting KIT · Math

Tukey HSD post-hoc

Find out which group means differ after an ANOVA: for groups averaging 2, 6 and 4, Tukey's test flags all three pairs as different at the 0.05 level. You get the means, the critical value and a table of every pair. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Labels
A, B, C
Alpha
0.05
You get
K
3
N total
12
Df error
9
Mse
0.6666666667

After a one-way ANOVA rejects the global null that every group mean is equal, researchers still need to know which pairs differ. Tukey’s honest significant difference (HSD) and its Tukey–Kramer form for unequal sample sizes answer that question with a single family-wise error rate: every pairwise mean difference is compared with a critical value built from the residual mean square, the group sizes, and the studentized-range quantile for the number of groups and error degrees of freedom. This capability accepts two or more numeric group arrays, optional labels and alpha, then returns group means, residual MSE, the critical q, the common HSD when sizes match, and a full pairwise table with significance flags.

What Tukey HSD means after a significant ANOVA

Analysis of variance tests whether at least one mean among k groups differs, but it does not name the pairs. Running ordinary two-sample t-tests on every pair inflates the chance of a false positive as the number of comparisons grows. Tukey’s procedure controls the family-wise error rate for all pairwise contrasts simultaneously by using the studentized range distribution: the critical distance depends on how large the biggest gap among k means would look under the null when scaled by the residual standard error.

When every group has the same sample size n, that distance is often written as a single honest significant difference HSD equals q-alpha of k and residual degrees of freedom times the square root of MSE over n. Any absolute mean difference larger than HSD is declared significant at the chosen alpha.

When sample sizes differ, the Tukey–Kramer adjustment replaces the common n with a pair-specific standard error using one over n-i plus one over n-j, so each comparison has its own critical difference while still sharing the same q critical value. Textbooks introduce HSD right after one-way ANOVA in psychology, biology, agriculture, and A/B product experiments. Hand calculation fails when MSE is mis-copied from the ANOVA table, when df-error is off by one, when labels are swapped, or when unequal n is ignored.

Automating the path from raw observations through MSE and pairwise flags removes those slips while still exposing the intermediate quantities a solution write-up expects.

Where to use it and what it costs

Typical placements include confirming which diet, fertilizer, or UI variant means separate after a significant one-way ANOVA, generating solution keys that list every pair beside its critical difference, teaching the difference between a global F test and pairwise HSD decisions, and feeding significant-pair flags into reports that already store raw group vectors. The browser path runs locally and needs no account.

Keep at least two groups with enough within-group replication for residual df at least one, prefer the server-computed mse and comparisons over re-deriving floating-point paths in ad hoc spreadsheets, and treat the result as a post-hoc step after ANOVA rather than a substitute for checking assumptions such as independence and roughly comparable residual variance.

Homework and exam keys

After students run a one-way ANOVA, verify which group pairs exceed Tukey HSD using one canonical pairwise table and HSD value.

Lab and field experiments

Pass treatment replicate arrays from biology or agriculture trials and store significant pairwise flags next to residual MSE.

Why not just run a t-test on every pair of groups?

Because each extra test adds another chance of a false positive, and with many pairs the errors pile up. Tukey's HSD compares all pairs at once while keeping a single overall error rate.

Can I use Tukey's test when the groups have different sizes?

Yes. With unequal sizes the calculator switches to the Tukey–Kramer version, which gives each pair its own critical difference based on the two group sizes while keeping the same critical q.

How do I read the pairwise table?

Each row compares two groups. If the absolute difference between their means is larger than the critical difference, the pair is marked significant. With means of 2, 6 and 4, the gaps of 4, 2 and 2 all clear that bar.

What significance level does the test use?

It uses 0.05 unless you choose another level, such as 0.01 or 0.10. That level applies to the whole family of comparisons, not to each pair separately.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/tukey-hsd

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/tukey-hsd \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"groups":[[1,2,3,2],[5,6,7,6],[3,4,5,4]]}'
{
  "groups": [
    [
      1,
      2,
      3,
      2
    ],
    [
      5,
      6,
      7,
      6
    ],
    [
      3,
      4,
      5,
      4
    ]
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.tukey_hsd",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How this capability computes the answer

Optional labels name groups when you pass a plain array of arrays; optional alpha sets the family-wise level and defaults to zero point zero five. For equal sample sizes it also reports the single HSD value; for unequal sizes it uses Tukey–Kramer pair-specific critical differences. The response also returns method name, k, n-total, df-error, mse, sse, q-crit, equal-sample-sizes, a groups summary with means and sample variances, and a count of significant pairs. You send a JSON body with a required groups field: either an array of at least two numeric arrays, or an object mapping string labels to numeric arrays. The engine parses finite numbers from JSON numbers or plain numeric strings, rejects fewer than two groups, empty groups, non-numeric cells, alpha outside the open unit interval, and designs with residual degrees of freedom below one, all with invalid_input and without charge. It computes each group mean and within-group sum of squares, pools residual SSE into MSE equals SSE over N minus k, approximates the studentized-range critical value q for alpha, k, and df-error, then forms every unordered pair. Each comparison lists both means, the signed and absolute difference, sample sizes, the range-scale standard error, the critical difference, the observed q statistic when defined, and a boolean significant flag. There is no randomness, no clock, and no network; identical inputs always yield identical JSON. The work is validation plus O of total observations plus O of k squared pairwise arithmetic, which sits inside the analytic cost model for this tier-A parse capability priced at $0.002 per successful request.

Where to use it and what it costs

Use the free browser tool for a homework check or a quick post-hoc on a small experiment, or call the API when a notebook, gradebook, lab pipeline, or product analytics job must resolve many multi-group comparisons the same way every time. API usage draws from prepaid KIT balance at the published $0.002 base price per successful request; failed validation does not consume balance.

Product A/B/n analytics

Batch multi-variant metric samples through the API and report which variants differ under a shared family-wise alpha.

How do I run a Tukey HSD calculator with this API?

POST JSON with groups as an array of numeric arrays (or a label map), optionally alpha and labels. The response includes mse, q_crit, hsd when sizes match, and a comparisons table with significant flags.

What if my groups have different sample sizes?

The engine uses the Tukey–Kramer form: each pair gets its own critical difference from MSE and the two sample sizes, still sharing one studentized-range q_crit for k and df_error.

What error do I get with fewer than two groups?

Validation fails with invalid_input stating that Tukey HSD requires at least two groups. That failure is not charged.

Is the Tukey HSD calculator free?

The browser widget is free and runs locally. API calls use prepaid KIT balance at the published $0.002 base price; invalid input is not charged.

Is the result always the same for the same inputs?

Yes. The algorithm is pure analytic arithmetic with a fixed critical-value approximation and no randomness or timestamps, so identical groups and alpha produce identical JSON.

Read the full KIT documentation →