Skip to course content
Free Python statistics course

Statistical Data Analytics with Python

Unit 04.01: The data's distribution is not the mean's

The distribution of the data and the distribution of the mean are two different things, and only the second one has to be well behaved.

Why a skewed population still gives a symmetric mean

A sampling distribution is the distribution of an estimate across repeated samples. It is not the distribution of the data, and beginners conflate the two constantly.

The central limit theorem says that as n grows, the sampling distribution of the mean becomes approximately normal *whatever the population looks like*, with a spread shrinking in proportion to the square root of n. That is why t-tests work on skewed data at reasonable sample sizes.

It is also why 'the data is not normal' is rarely the objection people think. The question is whether the sampling distribution is close enough to normal at your n, which depends on the skew and the sample size together.

This block draws from a strongly skewed population at three sample sizes.

import numpy as np

rng = np.random.default_rng(102)
population = rng.exponential(50, 100_000)     # strongly right-skewed
print(f"Population: exponential, mean {population.mean():.1f}, skewed right\n")

spreads = {}
for n in (5, 30, 200):
    means = np.array([rng.choice(population, n).mean() for _ in range(2000)])
    spreads[n] = means.std(ddof=1)
    lo, hi = np.percentile(means, [2.5, 97.5])
    print(f"n = {n:3d}   sample-mean SD {means.std(ddof=1):6.2f}"
          f"   middle 95%: {lo:6.1f} .. {hi:6.1f}")

print("\nThe population is nowhere near normal, yet the distribution OF THE")
print("MEANS becomes symmetric and narrow as n grows.")
print(f"  observed SD(n=5) / SD(n=200) : {spreads[5] / spreads[200]:.2f}")
print(f"  sqrt(200/5) predicts         : {np.sqrt(200 / 5):.2f}")
print("\nThat is why a t-test survives skewed data at a decent sample size:")
print("the assumption concerns the sampling distribution, not the data.")

The population is exponential with a mean near 49.9 and a long right tail. At n = 5 the sample means have a standard deviation of 22.42 and a middle 95% running from 16.5 to 101.6 — wide and clearly asymmetric. At n = 200 the standard deviation is 3.44 and the range 43.3 to 57.0, symmetric and tight. The observed ratio of spreads, 6.52, is close to the square-root-of-n prediction of 6.32.

The mistake this prevents

The mistake is testing the raw data for normality and abandoning a t-test when it fails. The assumption concerns the sampling distribution of the mean, which is far better behaved than the data at any decent n.

Takeaway

Distinguish the distribution of the data from the distribution of the estimate. Expect an estimate's spread to fall with the square root of n, and be more cautious about small samples than about non-normal ones.