Math calculator

Hotelling T-Squared Calculator

A difference in shape.

Compare profiles

Two classes of twenty, scored on reading and maths. Reading differs by 5.1 points with p = 0.2114; maths differs by 4.15 points the other way with p = 0.3232. Neither subject shows anything. The joint test gives T² = 42.3723, F = 20.6286, p = 0.00000096 — six orders of magnitude smaller than either separate test. The two scores correlate 0.8754, so a class that is better at reading should be better at maths; being ahead on one and behind on the other is a profile the correlation says should almost never occur. The difference is not in either subject, it is in the shape.

20 and 20 observations · 2 variables

T² = 42.3723, F = 20.6286, p = 9.5835e-7

No single variable reaches 0.05 on its own — the smallest individual p-value is 0.2114. The joint test finds the difference because it is in the combination of variables rather than in any one of them.

42.3723

2 variables

F

20.6286

df 2 and 37

Joint p-value

9.584e-7

profiles differ

Individual tests

0 of 2

at 0.05, Bonferroni 0.0250

One variable at a time

Each variable tested separately, for comparison with the joint result
VariableGroup oneGroup twoDifferencetp
Variable 148.350053.4500-5.1000-1.27130.21135
Variable 249.950045.80004.15001.00090.32318

Running these 2 tests and reporting the smallest p-value is the habit the joint test exists to replace. At 0.05 each, 2 independent tests reject something 9.8% of the time when nothing is going on. The Bonferroni threshold that fixes the rate is 0.02500, and it costs power.

With a single variable this statistic is exactly the ordinary t statistic squared, and the two p-values agree to fifteen decimal places. The verification suite asserts that on 240 generated datasets, one-sample and two-sample.

A significant joint result does not say which variable differs, and the individual tests above are not a valid way to find out afterwards. Simultaneous confidence intervals on the combinations are the defensible follow-up.

One test, not many Uses the correlations Reduces to t at p = 1 Assumes equal covariance

What this tool shows

On the shipped preset neither variable differs on its own — the two t tests give p = 0.2114 and p = 0.3232. The joint test on exactly the same data gives p = 0.00000096. The two scores correlate 0.8754, so a group ahead on one should be ahead on the other. This group is ahead on reading by 5.1 points and behind on maths by 4.15, which is a profile the correlation says should almost never happen. Neither difference is large. The combination is.

  • Hotelling's T-squared for one sample against a target vector, and for two independent samples
  • The exact F conversion with its two degrees of freedom, rather than a chi-square approximation
  • Every single-variable t test printed alongside, so the joint answer can be checked against the alternative
  • The Bonferroni threshold and the true family-wise error rate of running those tests separately
  • Presets where the joint test wins, where both agree, and where the joint test loses badly
  • Why adding variables to a multivariate test costs power rather than buying it
One test, not many Uses the correlations Reduces to t exactly Separate tests shown

It says the profiles differ. It does not say which variable.

Updated 13 September 2026 · Works in any browser, no installation

Hotelling’s T-squared tests whether two groups differ across several measurements at once, using the correlations between those measurements rather than examining each one separately. It is the t test with a vector of means in place of a single mean, and the covariance matrix in place of a single variance. Where the variables move together, it can find a difference that every individual test misses — and, less often admitted, it can miss one that a single test finds.

At a glance

Formula shown
For two samples, T² = (x̄₁ − x̄₂)ᵀ [S(1/n₁ + 1/n₂)]⁻¹ (x̄₁ − x̄₂), where S is the pooled covariance matrix. F = T²(n₁ + n₂ − p − 1) / [p(n₁ + n₂ − 2)] on p and n₁ + n₂ − p − 1 degrees of freedom. With p = 1 the matrix is a scalar, the inverse is a reciprocal, and the whole thing collapses to the ordinary t statistic squared — which is the cleanest way to check an implementation.
Scenario support
Comparing two groups on a battery of related measures, checking a manufacturing process against a multi-dimensional specification, testing whether a treatment changes a profile of outcomes rather than one endpoint, and any comparison where running a separate test per variable would inflate the error rate.
Educational estimate
Planning support from the values you enter — not professional advice.

The difference is in the shape, not the level

The shipped preset is built so the two approaches give incompatible answers, because that is the situation the method exists for and it is hard to picture in the abstract.

Reading differs by 5.1 points, p = 0.2114. Maths differs by 4.15 the other way, p = 0.3232. Two unremarkable results.

The joint test gives T² = 42.3723, F = 20.6286, p = 0.00000096. Six orders of magnitude below either individual result.

The scores correlate 0.8754. A class that is better at reading is almost always better at maths too. Being ahead on one and behind on the other is the rare thing.

The statistic measures distance in units of what the data actually does, not in units of each variable separately — the same idea as Mahalanobis distance, applied to a mean instead of a point.

And sometimes it loses, badly

The claim that a multivariate test is simply better is wrong, and the fourth preset is there to make the failure concrete rather than hypothetical.

Eight variables, fourteen observations per group, exactly one real difference. That one variable is off by 8.807 points at p = 0.0036.

The joint test gives p = 0.3190 and finds nothing. Seven variables of noise dilute one variable of signal.

There is also not enough data to estimate the covariance matrix. An 8 by 8 matrix has 36 free parameters and 26 residual degrees of freedom to estimate them from.

The practical rule is to choose the variables before looking, and to keep the number well below the sample size. Adding a variable because it was measured is how a real effect gets buried.

What running separate tests actually costs

The alternative to one joint test is several separate ones, and the price of that is arithmetic rather than opinion.

Five variables at 0.05 each reject something 22.6% of the time when nothing is going on. Ten variables get you to 40.1%.

Bonferroni fixes the rate by dividing the threshold, which is printed on the page alongside the individual p-values — and it costs power, sharply, as the number of variables grows.

The joint test holds the rate at 0.05 without dividing anything, because it is one test rather than several.

That control is worth having even when the individual tests all agree, which is what the second preset is for: both variables differ clearly, the joint test adds no power, and it is still the honest thing to report.

It does not tell you which variable

This is the most common misuse, and the page prints the individual tests partly so the temptation is visible rather than hidden.

A significant T-squared says the mean vectors differ. It says nothing about which component is responsible.

Looking at the individual t tests afterwards is not a valid answer, because the whole point of the example above is that they can all be non-significant while the joint test is decisive.

The defensible follow-up is simultaneous confidence intervals — Roy’s largest-root or Scheffé-type intervals, which hold over every linear combination of the variables at once.

Often the honest report is the profile itself: the direction that separates the groups, described in words. On the first preset that direction is “better at reading relative to maths”, which is not a statement about either variable alone.

Equal covariance, and what happens when it is not

The two-sample test pools the covariance matrices, and that step carries the assumption most likely to be wrong in practice.

Both groups are assumed to share one covariance matrix. Not just equal variances — equal correlations too.

With equal group sizes the test is fairly robust to violations. With unequal sizes it is not: the larger group dominates the pooled estimate and the error rate drifts.

Multivariate normality matters less than it is usually said to, by the same central limit argument that rescues the ordinary t test — but outliers matter more, because they affect the covariance matrix as well as the means.

Screen for those first. A Mahalanobis screen on each group separately takes a moment and catches the points that would otherwise quietly inflate the pooled matrix.

It reduces to the t test exactly

Multivariate statistics are easy to get wrong and hard to check against published values, so this engine is checked against a case with a known closed form instead.

With one variable, T-squared is the ordinary t statistic squared. The matrix is a scalar, the inverse is a reciprocal, and everything collapses.

The suite asserts that on 240 generated datasets, 120 one-sample and 120 two-sample, with the statistics agreeing to a relative 1e-9 and the p-values to 1e-9.

That is a stronger check than a worked textbook example, because it runs on random sample sizes and random means rather than one fixed table, and it would catch an error in the pooling, the inversion, the F conversion or the degrees of freedom.

The two-sample reduction matches to exactly zero difference, not merely to within a tolerance — the same floating-point operations happen in the same order.

Reporting a multivariate comparison

Four items, and the third is the one that separates a defensible report from a fishing expedition.

Give T-squared, the F, both degrees of freedom and the p-value. The F and its degrees of freedom are what anyone else needs to reproduce the result.

Give the group sizes and the number of variables. Their ratio is what determines whether the covariance matrix was estimable at all.

Say that the variables were chosen in advance. If they were not, say that too — the test assumes the list was fixed before the data was seen.

And describe the direction, not the individual variables. “Ahead on one measure relative to the other” is what the test found; “variable 3 differs” is not.

Sources and methodology

References for the statistic and its distribution.

Method. The pooled covariance matrix is inverted by Gauss-Jordan elimination with partial pivoting, and the statistic is converted to an exact F rather than referred to a chi-square approximation, so the result is correct at small sample sizes rather than only asymptotically. The verification suite checks the whole pipeline against a case with a closed form: with a single variable, T-squared must equal the ordinary t statistic squared and the p-values must agree. That is asserted on 240 generated datasets — 120 one-sample against random target vectors and 120 two-sample with random, unequal group sizes — and the two-sample reduction matches to exactly zero rather than merely within tolerance. The individual t tests printed beside the joint result are computed independently of it, which is what makes the comparison on the page meaningful. That engine is verified on every change against 90 assertions. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Mahalanobis DistanceMultivariate outlier distance with the chi-square cutoff, each row's largest z-score beside it, and a count of the points only the joint screen finds.
Covariance MatrixSample covariance and correlation matrices with eigenvalues, determinant and condition number, so redundancy spread across several variables cannot hide from a pairwise scan.
t-testOne-sample, two-sample and paired t-tests defaulting to Welch, with Student's pooled version printed beside it — and a warning when the two disagree on the verdict.
One-Way ANOVAThe full F table with eta and omega squared, plus every pairwise gap — because a significant F says something differs and never says which, and ten groups tested pairwise carry a 90% false-positive rate.
Multiple CorrelationMultiple R with adjusted R-squared, an F test, and a per-predictor table of simple, partial and unique contributions beside the variance inflation factors.
Effect SizeCohen d, Hedges g and the overlap between groups, with a sample-size control that moves the p-value while leaving the effect size fixed — the same d gives t = 1.29 at n=30 and 23.57 at n=10,000.

More in Math, or browse all calculators.

Educational use disclaimer

An educational tool. The two-sample test assumes both groups share one covariance matrix, which matters most when the groups are different sizes. A significant result says the mean vectors differ and does not identify which variable is responsible — reading that off the individual tests afterwards is not valid, and simultaneous intervals are the defensible follow-up.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (5 updates)

Published 13 September 2026

  1. Published one-sample and two-sample multivariate mean tests with an exact F conversion.
  2. Printed every single-variable t test alongside the joint result, with the Bonferroni threshold.
  3. Shipped a preset where the separate tests give p = 0.2114 and 0.3232 and the joint test gives p = 9.58e-7.
  4. Added a counterweight preset where eight variables dilute one real difference to a joint p of 0.3190.
  5. Stated that a significant result does not identify which variable differs.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.