12 — Analyze Your Data

Distribution Shape#

Data Analysis✓ Mathematical
◆ The PatternSkewness, kurtosis, QQ plots — is your data normal, and does it matter?

Before modelling, know your data's shape. Skewness measures asymmetry (are the tails lopsided?), kurtosis measures tail heaviness (how many extreme values?), and QQ plots show deviations from normality at a glance.

Skew = E[(X−μ)³] / σ³
Skew = 0 is symmetric  |  >0 right tail  |  <0 left tail
Kurt = E[(X−μ)⁴] / σ⁴ − 3
Excess kurtosis = 0 is normal  |  >0 heavy tails  |  <0 light tails
// Interactive — adjust skew and kurtosis
Skewness0.0
Tail weight3.0
# Python — distribution diagnostics
from scipy.stats import skew, kurtosis, probplot
import matplotlib.pyplot as plt

print(f"Skew: {skew(data):.3f}")
print(f"Kurt: {kurtosis(data):.3f}")

# QQ plot — points on line = normal
fig, ax = plt.subplots()
probplot(data, plot=ax)
plt.show()
When it matters: Linear regression assumes normal residuals. Many tests assume normality. Log-transform right-skewed data. Market returns have heavy tails (excess kurtosis) — never assume normal.
← Previous
Information Gain & Mutual Information
Open in the full reader, with the topic sidebar →