分散と標準偏差
分散・標準偏差の定義、計算、n-1補正(ベッセル補正)、偏差を二乗する理由を初学者向けに解説します。
分散と標準偏差:式から直感まで
分散と標準偏差は、データのばらつきを表す基本指標です。この記事では以下を扱います。
- 定義と直感
- 計算のショートカット式
- なぜ標本分散は で割るのか
- なぜ偏差を絶対値でなく二乗するのか
0. 記号
- データ:
- 標本平均:
- 母分散:
- 不偏標本分散:
- 標準偏差:
1. 直感
偏差 は総和が0になるため、ばらつき指標としては二乗して平均を取ります。
- 分散:平均からの二乗距離の平均
- 標準偏差:分散の平方根で、元の単位に戻した量
Interactive Demo: Small vs. Large Variance
Low Variance (n = 18)
Distribution Histogram
Key Observations:
- • Low variance → data clustered tightly around the mean (narrow bell)
- • High variance → data spread widely from the mean (wide, flat bell)
- • The smooth curve approximates the normal distribution shape
- • Standard deviation bands show typical spread ranges
2. ショートカット公式
展開すると、
となり、計算を簡略化できます。したがって
です。
3. 例
データ ()では
- 偏差二乗和
4. なぜ で割るか
で割ると平均的に過小評価になります。
そこで で割ると
となり、不偏推定量になります。
Interactive Demo: Understanding Biased vs Unbiased Variance
Sample Histogram
Step-by-Step Calculations
Key Observations:
Why n-1? When we use the sample mean x̄ to calculate deviations, we lose one degree of freedom. The biased estimator (÷n) systematically underestimates the population variance, especially for small samples.
Bessel's Correction: Dividing by (n-1) instead of n corrects this bias. The unbiased estimator's expected value equals the true population variance: E[s²] = σ².
Try different sample sizes: Notice how the bias is more pronounced with smaller samples (n=3-10) but becomes negligible as n grows large. The histogram shows how your sample compares to the true population distribution.
5. なぜ二乗するのか
- 平均との整合性がよい(最小二乗)
- 代数的に扱いやすい(分散公式)
- 微分可能で最適化しやすい
- 幾何学的にユークリッド距離と対応する
- 独立和で分散の加法性が成り立つ
まとめ
- 分散と標準偏差は、ばらつきを定量化する最重要指標。
- ショートカット式で手計算を簡単にできる。
- 補正は不偏性のために必要。
- 二乗には理論的・計算的な利点がある。