xbe.at

Statistics and maths / Probability and distributions

Limitations of Normal Distribution in Nature

7 min read, 14 sections

Contents
  1. The Limitations of Normal Distribution
  2. Asymmetry in Nature
  3. Multiplicative Processes
  4. Heavy-Tailed Distributions in Real Life
  5. Limitations of the Central Limit Theorem
  6. Biochemical Reactions and Non-Normality
  7. Non-Additive Effects in Biology
  8. Time Series and Non-Stationarity
  9. Network Effects and Power Laws
  10. Extreme Events and Fat Tails
  11. Handling Non-Normal Data
  12. Modeling Complex Systems
  13. Beyond the Normal: Embracing Complexity
  14. Additional Resources

The Limitations of Normal Distribution

The normal distribution, while widely used, is not always the best model for real-world phenomena. Many natural processes are asymmetric or involve multiplicative effects, which the normal distribution fails to capture accurately.

import numpy as np
import matplotlib.pyplot as plt

# Generate data from different distributions
normal = np.random.normal(0, 1, 1000)
lognormal = np.random.lognormal(0, 1, 1000)
exponential = np.random.exponential(1, 1000)

# Plot histograms
plt.figure(figsize=(12, 4))
plt.subplot(131)
plt.hist(normal, bins=30, alpha=0.7)
plt.title('Normal')
plt.subplot(132)
plt.hist(lognormal, bins=30, alpha=0.7)
plt.title('Lognormal')
plt.subplot(133)
plt.hist(exponential, bins=30, alpha=0.7)
plt.title('Exponential')
plt.tight_layout()
plt.show()

Asymmetry in Nature

Many natural phenomena exhibit asymmetry, which is not well-represented by the normal distribution. Examples include reaction times, income distributions, and species abundance in ecosystems.

import numpy as np
import matplotlib.pyplot as plt

# Simulate reaction times (typically right-skewed)
reaction_times = np.random.gamma(shape=2, scale=0.1, size=1000)

plt.figure(figsize=(10, 5))
plt.hist(reaction_times, bins=30, edgecolor='black')
plt.title('Distribution of Reaction Times')
plt.xlabel('Time (seconds)')
plt.ylabel('Frequency')
plt.show()

print(f"Mean: {np.mean(reaction_times):.2f}")
print(f"Median: {np.median(reaction_times):.2f}")

Multiplicative Processes

Many natural processes involve multiplicative effects, leading to distributions with heavy tails. These are poorly approximated by the normal distribution.

import numpy as np
import matplotlib.pyplot as plt

def multiplicative_process(n_steps, n_simulations):
    result = np.ones(n_simulations)
    for _ in range(n_steps):
        result *= np.random.uniform(0.9, 1.1, n_simulations)
    return result

outcomes = multiplicative_process(100, 10000)

plt.figure(figsize=(10, 5))
plt.hist(outcomes, bins=50, edgecolor='black')
plt.title('Outcomes of a Multiplicative Process')
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.show()

print(f"Skewness: {np.mean((outcomes - np.mean(outcomes))**3) / np.std(outcomes)**3:.2f}")

Heavy-Tailed Distributions in Real Life

Heavy-tailed distributions are common in many fields, including biology, physics, and social sciences. They often arise from complex systems with interactions and feedback loops.

import numpy as np
import matplotlib.pyplot as plt

# Simulate city populations (often follow a power-law distribution)
alpha = 2.0  # Power-law exponent
min_size = 1000
n_cities = 1000

city_sizes = min_size * (1 - np.random.random(n_cities)) ** (-1 / (alpha - 1))

plt.figure(figsize=(10, 5))
plt.hist(np.log10(city_sizes), bins=30, edgecolor='black')
plt.title('Distribution of City Sizes (Log Scale)')
plt.xlabel('Log10(Population)')
plt.ylabel('Frequency')
plt.show()

print(f"Largest city: {int(np.max(city_sizes)):,}")
print(f"Smallest city: {int(np.min(city_sizes)):,}")

Limitations of the Central Limit Theorem

While the Central Limit Theorem (CLT) is powerful, it has limitations. It assumes independent, identically distributed random variables with finite variance, which doesn't always hold in practice.

import numpy as np
import matplotlib.pyplot as plt

def sample_mean(distribution, sample_size, n_samples):
    return np.array([np.mean(distribution(sample_size)) for _ in range(n_samples)])

n_samples = 1000
sample_size = 30

normal_means = sample_mean(lambda n: np.random.normal(0, 1, n), sample_size, n_samples)
cauchy_means = sample_mean(lambda n: np.random.standard_cauchy(n), sample_size, n_samples)

plt.figure(figsize=(12, 5))
plt.subplot(121)
plt.hist(normal_means, bins=30, edgecolor='black')
plt.title('Sample Means (Normal)')
plt.subplot(122)
plt.hist(cauchy_means, bins=30, edgecolor='black')
plt.title('Sample Means (Cauchy)')
plt.tight_layout()
plt.show()

Biochemical Reactions and Non-Normality

Biochemical reactions often involve cascades and feedback loops, leading to non-normal distributions of metabolite concentrations and reaction rates.

import numpy as np
import matplotlib.pyplot as plt

def enzyme_kinetics(substrate, vmax, km):
    return vmax * substrate / (km + substrate)

substrate = np.linspace(0, 10, 100)
vmax = 1.0
km = 2.0

reaction_rate = enzyme_kinetics(substrate, vmax, km)

plt.figure(figsize=(10, 5))
plt.plot(substrate, reaction_rate)
plt.title('Michaelis-Menten Enzyme Kinetics')
plt.xlabel('Substrate Concentration')
plt.ylabel('Reaction Rate')
plt.show()

print(f"Half-maximal rate at substrate concentration: {km}")

Non-Additive Effects in Biology

Many biological processes involve non-additive effects, such as gene interactions or synergistic drug effects, which can lead to complex, non-normal distributions.

import numpy as np
import matplotlib.pyplot as plt

def synergistic_effect(drug1, drug2, interaction_strength=0.5):
    return drug1 + drug2 + interaction_strength * drug1 * drug2

drug1_levels = np.linspace(0, 1, 20)
drug2_levels = np.linspace(0, 1, 20)

X, Y = np.meshgrid(drug1_levels, drug2_levels)
Z = synergistic_effect(X, Y)

plt.figure(figsize=(10, 8))
plt.contourf(X, Y, Z, levels=20, cmap='viridis')
plt.colorbar(label='Combined Effect')
plt.title('Synergistic Drug Interaction')
plt.xlabel('Drug 1 Concentration')
plt.ylabel('Drug 2 Concentration')
plt.show()

Time Series and Non-Stationarity

Many real-world time series exhibit non-stationarity, which violates the assumptions of many statistical models based on normal distributions.

import numpy as np
import matplotlib.pyplot as plt

def non_stationary_series(n_points):
    t = np.arange(n_points)
    trend = 0.05 * t
    seasonality = 10 * np.sin(2 * np.pi * t / 365)
    noise = np.random.normal(0, 1, n_points)
    return trend + seasonality + noise

time_series = non_stationary_series(1000)

plt.figure(figsize=(12, 5))
plt.plot(time_series)
plt.title('Non-Stationary Time Series')
plt.xlabel('Time')
plt.ylabel('Value')
plt.show()

print(f"Trend-cycle correlation: {np.corrcoef(np.arange(1000), time_series)[0, 1]:.2f}")

Network Effects and Power Laws

Many real-world networks exhibit power-law degree distributions, which are far from normal and have important implications for system behavior.

import networkx as nx
import matplotlib.pyplot as plt

# Generate a scale-free network
G = nx.barabasi_albert_graph(1000, 2)

degrees = [d for n, d in G.degree()]

plt.figure(figsize=(10, 5))
plt.hist(degrees, bins=30, edgecolor='black')
plt.title('Degree Distribution in a Scale-Free Network')
plt.xlabel('Node Degree')
plt.ylabel('Frequency')
plt.yscale('log')
plt.show()

print(f"Maximum degree: {max(degrees)}")
print(f"Average degree: {sum(degrees) / len(degrees):.2f}")

Extreme Events and Fat Tails

Many natural and social phenomena exhibit fat-tailed distributions, where extreme events are much more likely than predicted by normal distributions.

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm, pareto

x = np.linspace(0, 10, 1000)
normal_pdf = norm.pdf(x, loc=5, scale=1)
pareto_pdf = pareto.pdf(x, b=2, loc=0, scale=1)

plt.figure(figsize=(10, 5))
plt.plot(x, normal_pdf, label='Normal')
plt.plot(x, pareto_pdf, label='Pareto')
plt.title('Normal vs. Fat-Tailed (Pareto) Distribution')
plt.xlabel('Value')
plt.ylabel('Probability Density')
plt.legend()
plt.yscale('log')
plt.show()

print(f"P(X > 5) for Normal: {1 - norm.cdf(5, loc=5, scale=1):.4f}")
print(f"P(X > 5) for Pareto: {1 - pareto.cdf(5, b=2, loc=0, scale=1):.4f}")

Handling Non-Normal Data

When dealing with non-normal data, techniques like data transformation, robust statistics, or non-parametric methods can be more appropriate than assuming normality.

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

# Generate right-skewed data
data = np.random.lognormal(0, 1, 1000)

plt.figure(figsize=(12, 5))

plt.subplot(121)
plt.hist(data, bins=30, edgecolor='black')
plt.title('Original Data')

plt.subplot(122)
plt.hist(np.log(data), bins=30, edgecolor='black')
plt.title('Log-Transformed Data')

plt.tight_layout()
plt.show()

print(f"Skewness (original): {stats.skew(data):.2f}")
print(f"Skewness (log-transformed): {stats.skew(np.log(data)):.2f}")

Modeling Complex Systems

Complex systems often require more sophisticated models that can capture non-linear interactions and emergent behaviors, going beyond simple normal distributions.

import numpy as np
import matplotlib.pyplot as plt

def lotka_volterra(t, state, a, b, c, d):
    x, y = state
    return [a*x - b*x*y, -c*y + d*x*y]

def simulate(t, state0, params):
    dt = t[1] - t[0]
    state = np.array(state0)
    result = [state]
    for _ in t[1:]:
        state = state + np.array(lotka_volterra(_, state, *params)) * dt
        result.append(state)
    return np.array(result)

t = np.linspace(0, 30, 1000)
result = simulate(t, [10, 5], [1.5, 1, 3, 1])

plt.figure(figsize=(10, 5))
plt.plot(t, result[:, 0], label='Prey')
plt.plot(t, result[:, 1], label='Predator')
plt.title('Lotka-Volterra Predator-Prey Model')
plt.xlabel('Time')
plt.ylabel('Population')
plt.legend()
plt.show()

Beyond the Normal: Embracing Complexity

Recognizing the limitations of normal distributions opens up new possibilities for modeling and understanding complex systems. Embracing non-normality can lead to more accurate and insightful analyses in many fields.

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm, cauchy, lognorm, pareto

x = np.linspace(-5, 15, 1000)
distributions = [
    ('Normal', norm(loc=0, scale=1).pdf(x)),
    ('Cauchy', cauchy(loc=0, scale=1).pdf(x)),
    ('Lognormal', lognorm(s=1, loc=0, scale=np.exp(0)).pdf(x)),
    ('Pareto', pareto(b=2, loc=1, scale=1).pdf(x))
]

plt.figure(figsize=(12, 8))
for i, (name, dist) in enumerate(distributions):
    plt.subplot(2, 2, i+1)
    plt.plot(x, dist)
    plt.title(name)
    plt.xlabel('Value')
    plt.ylabel('Probability Density')

plt.tight_layout()
plt.show()

Additional Resources

For further exploration of non-normal distributions and complex systems:

  1. "Statistical Rethinking" by Richard McElreath
  2. "Scale: The Universal Laws of Growth, Innovation, Sustainability, and the Pace of Life in Organisms, Cities, Economies, and Companies" by Geoffrey West
  3. "The Black Swan: The Impact of the Highly Improbable" by Nassim Nicholas Taleb
  4. ArXiv.org: "Power-law distributions in empirical data" by Aaron Clauset, Cosma Rohilla Shalizi, M. E. J. Newman (https://arxiv.org/abs/0706.1062)
  5. ArXiv.org: "Complex Systems: A Survey" by Cosma Rohilla Shalizi (https://arxiv.org/abs/1112.0835)

More in Probability and distributions

  1. Non-Normality Tests Using Python8 min

    Non-normality tests are statistical tools used to assess whether a given dataset deviates from a normal distribution. It's crucial to understand that these...

  2. Gaussian Mixture Model12 min

    Gaussian Mixture Models (GMMs) are powerful probabilistic models used for clustering and density estimation. They represent complex probability distributions...

  3. Normal Distribution in Data Science8 min

    Probability distributions are fundamental concepts in statistics and data science. They describe the likelihood of different outcomes in a random event or...

  4. Gaussian Filters for Smoothing Time Series Data6 min

    The Gaussian filter is a fundamental smoothing technique that applies a weighted average using the normal distribution. It's particularly effective for...

  5. Probability & Statistics for Data Science and AI14 min

    Understanding probability distributions is fundamental to data science and machine learning. They describe the likelihood of different outcomes occurring in...

  6. Exploring Conditional Probability with Python12 min

    Conditional probability is a fundamental concept in statistics that allows us to calculate the likelihood of an event occurring given that another event has...