Skip to content

Probability Distributions

A distribution describes all possible values a variable can take and how probable each value is. Understanding distributions lets you choose the right statistical test, interpret results correctly, and build better models.

Learning Objectives

  • Understand the normal distribution and the 68-95-99.7 rule
  • Understand the Central Limit Theorem and why it matters
  • Know when to use normal, binomial, and Poisson distributions
  • Apply distribution knowledge to business scenarios

The Normal Distribution

The normal (Gaussian) distribution is the bell curve. Many real-world measurements — heights, test scores, measurement errors — follow it.

import numpy as np
import matplotlib.pyplot as plt
from scipy import stats

# Parameters
mu = 250    # mean order value
sigma = 80  # standard deviation

# Generate the PDF
x = np.linspace(mu - 4*sigma, mu + 4*sigma, 300)
y = stats.norm.pdf(x, mu, sigma)

fig, ax = plt.subplots(figsize=(10, 5))
ax.plot(x, y, color="#0D9488", linewidth=2)
ax.fill_between(x, y, where=(x >= mu - sigma) & (x <= mu + sigma),
                alpha=0.3, color="#0D9488", label="68%: μ ± 1σ")
ax.fill_between(x, y, where=(x >= mu - 2*sigma) & (x <= mu + 2*sigma),
                alpha=0.15, color="#0D9488", label="95%: μ ± 2σ")
ax.axvline(mu, color="red", linestyle="--", label=f"Mean: £{mu}")
ax.set_title("Normal Distribution: Order Values (μ=£250, σ=£80)")
ax.set_xlabel("Order Value (£)")
ax.legend()
plt.tight_layout()
plt.show()

The 68-95-99.7 Rule

mu, sigma = 250, 80

print(f"68% of orders: £{mu-sigma:.0f} – £{mu+sigma:.0f}")      # 170 – 330
print(f"95% of orders: £{mu-2*sigma:.0f} – £{mu+2*sigma:.0f}")  # 90 – 410
print(f"99.7% of orders: £{mu-3*sigma:.0f} – £{mu+3*sigma:.0f}") # 10 – 490

# What probability an order exceeds £400?
p_above_400 = 1 - stats.norm.cdf(400, loc=mu, scale=sigma)
print(f"P(order > £400): {p_above_400:.3f}")  # 6.1%

The Central Limit Theorem (CLT)

The most important theorem in statistics:

If you take many samples from any distribution, the sample means will be approximately normally distributed — regardless of the underlying distribution shape.

This is why: - You can run t-tests even when raw data is skewed - Confidence intervals work - Statistical inference is possible

# Demonstrate CLT: simulate right-skewed data
np.random.seed(42)
population = np.random.exponential(scale=200, size=100_000)

print(f"Population: mean={population.mean():.0f}, skew={stats.skew(population):.2f}")

# Take many samples and compute their means
sample_means = [np.random.choice(population, size=30).mean() for _ in range(1000)]

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))
ax1.hist(population[:1000], bins=40, color="#0D9488", alpha=0.7, edgecolor="none")
ax1.set_title("Individual Order Values (Right-Skewed)")

ax2.hist(sample_means, bins=40, color="#F59E0B", alpha=0.7, edgecolor="none")
ax2.set_title("Distribution of Sample Means (Nearly Normal)")

plt.tight_layout()
plt.show()

The Binomial Distribution

Used for counting successes in a fixed number of independent trials, each with the same success probability.

Business example: "Out of 100 emails sent, how many will be opened?" (if open rate = 25%)

from scipy.stats import binom

n = 100    # 100 emails
p = 0.25   # 25% open rate

# Expected opens
expected = n * p
print(f"Expected opens: {expected:.0f}")  # 25

# Probability of exactly 30 opens
prob_30 = binom.pmf(30, n, p)
print(f"P(exactly 30 opens): {prob_30:.4f}")

# Probability of 25 or more opens
prob_25_plus = 1 - binom.cdf(24, n, p)
print(f"P(25 or more opens): {prob_25_plus:.4f}")

# Confidence interval for the number of opens
lower, upper = binom.interval(0.95, n, p)
print(f"95% CI: {lower:.0f}{upper:.0f} opens expected")

The Poisson Distribution

Used for counting how many times an event occurs in a fixed time period (when events are rare and independent).

Business example: "How many support tickets arrive per hour?"

from scipy.stats import poisson

lam = 8   # average 8 tickets per hour

# Probability of exactly 10 tickets in an hour
prob_10 = poisson.pmf(10, lam)
print(f"P(exactly 10 tickets): {prob_10:.4f}")

# Probability of more than 15 tickets (need extra staff)
prob_overflow = 1 - poisson.cdf(15, lam)
print(f"P(>15 tickets — staff overflow): {prob_overflow:.4f}")

Which Distribution to Use?

Situation Distribution Example
Symmetric, unbounded continuous data Normal Heights, measurement errors, sample means (CLT)
Counting successes in N trials Binomial Email opens, click-through, conversion
Counting events in a time period Poisson Support tickets, page requests, transactions
Right-skewed, positive continuous Log-normal Revenue, income, prices
Wait time until an event Exponential Time between orders

Testing if Data is Normally Distributed

# Shapiro-Wilk test (good for n < 5000)
stat, p_value = stats.shapiro(df["total"].sample(min(1000, len(df))))
print(f"Shapiro-Wilk: p = {p_value:.4f}")
print(f"Normal at 5% level: {p_value > 0.05}")

# Q-Q plot (visual test)
fig, ax = plt.subplots(figsize=(6, 6))
stats.probplot(df["total"], dist="norm", plot=ax)
ax.set_title("Q-Q Plot: Is order total normally distributed?")
plt.tight_layout()
plt.show()

Practice Exercises

Warm-up 1. If order values are normally distributed with mean £250 and std £80, what percentage of orders will be above £350? 2. You send 500 emails with a 20% open rate. Use the binomial distribution to find P(exactly 100 opens) and P(95 or more opens). 3. Support tickets arrive at 12/hour on average. Find P(more than 20 in one hour) using Poisson.

Main 4. Demonstrate the Central Limit Theorem: draw 1000 samples of size 30 from your right-skewed total column. Plot the distribution of sample means and confirm it's approximately normal. 5. Use a Shapiro-Wilk test and Q-Q plot to check if total is normally distributed. Is it? What does that mean for choosing statistical tests? 6. If 8% of orders are cancelled, and you have 150 orders next week, what is the expected number of cancellations? What is P(more than 20 cancellations)?


Interview Questions

[Beginner] What is the normal distribution? Describe its key properties.

[Mid-level] What is the Central Limit Theorem and why does it matter for statistical inference?

[Senior] Your order data is highly right-skewed. A junior analyst wants to run a t-test on it. What do you tell them?


← Probability Basics · Next: Statistics for Business →