Hotelling's T² Laboratory
Multivariate Hypothesis Testing
Mastery
0 pts
Foundation Module 00

Why Not Just Run
p Separate t-Tests?

Before we compute anything, we need to build the right intuition. This module shows you the core problem that Hotelling's T² was designed to solve.

The Problem with Multiple Univariate Tests

The Family-Wise Error Rate

Suppose we have p = 3 variables and test each independently at α = 0.05. What is the probability that we make at least one false rejection, even if H₀ is true for all variables?

P(at least one false rejection) = 1 − (1 − α)p = 1 − (1 − 0.05)30.143

That's a 14.3% error rate — nearly 3× our intended α. As p grows, this compounds. Hotelling's T² tests all variables simultaneously, controlling the error rate precisely at α.

The deeper issue: Separate t-tests also ignore correlations between variables. Two variables might look fine individually, but their joint behavior can reveal a departure from H₀ that neither test alone would catch.
Interactive Intuition: Click to see univariate vs. joint testing
Variable 1 alone — t-test
Variable 2 alone — t-test
Joint distribution — Hotelling's T² sees this
Notice: Each variable's mean appears close to μ₀. A t-test on either alone would fail to reject H₀. But the joint displacement is significant — Hotelling's T² correctly detects it.
Concept Check
You run three separate t-tests each at α = 0.01. Under H₀ (all tests), what is the approximate probability of making at least one Type I error?
A
Exactly 1% — you set α = 0.01
B
About 3% — close to 3 × 0.01
C
About 2.97% — specifically 1 − (0.99)³
D
0% — independent tests don't compound errors
Setup Module 01

Configure & Make Your Prediction

Set your experimental parameters. Then — before seeing any data — make a prediction. This activates your prior knowledge and creates a meaningful moment of comparison later.

Experiment Parameters
Sample Size n
Range: 20 – 30
Significance α
P(Type I error) threshold
Distributions p
Number of variables (2–5)
Explore Module 02

Explore Your Dataset

Before computing, develop visual intuition about the data. The goal is to form an informed guess about whether Ȳ differs meaningfully from μ₀.

Dataset Overview
Visual Exploration

Scatter Plots: Observations vs. μ₀

The dashed horizontal line marks μ₀ᵢ. Does the cloud of points appear centered on μ₀?

Concept Check
Looking at the scatter plots, what determines whether a deviation from μ₀ is statistically meaningful?
A
Only the raw gap between ȳᵢ and μ₀ᵢ matters
B
The gap relative to the spread (variance) of the data — the same gap means more when data is tightly clustered
C
Only the number of observations n matters
D
The sign of the deviation determines significance
Computation Module 03

Compute the Sample Mean Vector Ȳ

The sample mean is your best estimate of the true population mean. The key question is: how far does Ȳ sit from μ₀?

Core Concept

The sample mean ȳᵢ is the arithmetic average of all n observations for variable i. As n grows, ȳᵢ converges to the true μᵢ (Law of Large Numbers). It is an unbiased estimator: E[ȳᵢ] = μᵢ.

Formula
ȳᵢ = (1/n) · Σⱼ yᵢⱼ  for i = 1, ..., p
n
Number of observations
yᵢⱼ
j-th observation of variable i
ȳᵢ
Sample mean for variable i
See a worked example first
Worked Example (p=2, n=3)

Suppose y₁ = [4.2, 3.8, 4.6]. Then:
ȳ₁ = (4.2 + 3.8 + 4.6) / 3 = 12.6 / 3 = 4.2
If μ₀₁ = 4.0, then ȳ₁ − μ₀₁ = 0.2. Is that large? Depends on the variance!

Stuck?
Computation Module 04

Compute the Sample Covariance Matrix S

Variance tells us how spread out the data is — a key context for judging whether deviations from μ₀ are surprising. A large variance means the same gap is less evidence against H₀.

Why (n−1) in the denominator?

Dividing by (n−1) rather than n gives us an unbiased estimator of σᵢ². Using n would systematically underestimate the true population variance because we've already "used" the data to estimate ȳᵢ — consuming one degree of freedom.

Formula
sᵢ = (1/(n−1)) · Σⱼ (yᵢⱼ − ȳᵢ)²
S = diag(s₁, s₂, ..., sₚ)  ← diagonal because variables are independent
See a worked example first
Worked Example (p=1, n=3)

y₁ = [4.2, 3.8, 4.6], ȳ₁ = 4.2
Deviations: (4.2−4.2)² = 0, (3.8−4.2)² = 0.16, (4.6−4.2)² = 0.16
s₁ = (0 + 0.16 + 0.16) / (3−1) = 0.32 / 2 = 0.16

Stuck?
Computation Module 05

Compute the T² Statistic

T² combines everything: how far the sample mean deviates from μ₀, scaled by the uncertainty in each variable, amplified by sample size.

Geometric Intuition

T² is proportional to the squared Mahalanobis distance from Ȳ to μ₀. Unlike Euclidean distance, it accounts for the "scale" of each variable via S⁻¹. A large T² means Ȳ is many standard deviations away from μ₀ — jointly.

Formula & Term Breakdown
= n · μ₀)T · S⁻¹ · μ₀)
For diagonal S: = n · Σᵢ (ȳᵢ − μ₀ᵢ)² / sᵢ
n
Sample size — more data amplifies evidence
(ȳᵢ−μ₀ᵢ)²
Squared departure from null hypothesis
1/sᵢ
Inverse variance — tight data → more signal
Σᵢ
Sum over all p variables (joint evidence)
Your T² value
Stuck?
T² Gauge
0
Type your T² value above
Decision Module 06

Look Up the Critical Value T²p,α

The critical value is the threshold T² must exceed to reject H₀. It depends on df = n−1 and your chosen α. The highlighted row and cell are your target.

What does the critical value represent?

Under H₀, T² follows a distribution related to the F-distribution. The critical value T²p,α is chosen so that P(T² > T²p,α | H₀) = α. Rejecting when T² > T²p,α means we have only an α chance of being wrong.

Hotelling's T² Table

Degrees of freedom = n − 1 = . Significance level α = .

Critical value T²p,α
Decision Module 07

The Decision & Reflection

The numbers are in. Now comes the most important step: making sense of what they mean.

The Comparison
How Did Your Predictions Do?
Sensitivity to Significance Level

What if α were different?

The same T² statistic can lead to different conclusions depending on α. Observe how the decision changes:

T² vs. Critical Values Across α Levels
Sampling Distribution

Where does T² fall in the null distribution?

Critical Thinking: Error Types
Based on this test outcome, which error are we potentially making?
Counterfactual Analysis: "What if α were different?"
Synthesis: Explain in Plain Language

The best way to consolidate statistical understanding is to explain what happened — without formulas.

Advanced Module 08

Sensitivity Analysis:
Can You Flip the Decision?

The original decision was: . Your challenge: change exactly one observation to reverse it. This reveals how influential individual data points can be.

What changes when you modify yᵢⱼ?

Changing a single observation affects both ȳᵢ (the sample mean for variable i) and sᵢ (the variance). The effect on T² works through both: a shift in ȳᵢ changes the numerator (ȳᵢ − μ₀ᵢ)², while a change in sᵢ changes the denominator. These effects can compound or cancel.

Modify One Observation
Distribution i
Observation j
Current value: —
New Value
Final Synthesis

What have you learned?

1
Why does T² require both ȳᵢ − μ₀ᵢ and sᵢ — not just one of them?
2
A colleague argues: "If all p individual t-tests retain H₀, then Hotelling's T² will also retain H₀." Is this correct? Why or why not?
3
You modified one observation and flipped (or tried to flip) the test outcome. What does this tell you about the limitations of hypothesis testing with small samples?