統計って、じつはめっちゃ面白い。
公式を暗記するやつじゃなくて、グラフで感じて「あ、そうだったのか!」と気づく学問だ。
Statistics is way more fun than it looks.
Forget rote formulas — here the graphs move on their own, and you just feel the math click.
ぶっちゃけ この曲線ひとつがなければ、
この先に出てくる検定も、信頼区間も、t分布も、回帰分析も、ぜんぶ成立しない。
標準正規分布 N(0, 1) は、平均0・標準偏差1のベル型カーブ。
「どんな正規分布も z = (x − μ) / σ でここに重ねられる」という一行のトリックが、
100年前の統計学者たちに"紙の表ひとつで世界中の確率を計算する"力を与えた。
つまりこれは、統計のラスボスじゃなくて、起源(オリジン)。
ここさえ掴めれば、残りのページは"標準正規の応用"として一気通貫で読める。
Honestly — without this single curve, none of what follows (tests, confidence intervals, the t-distribution, regression) would work.
The standard normal N(0, 1) is a bell curve with mean 0 and standard deviation 1.
The one-line trick "z = (x − μ) / σ" lets every normal distribution collapse onto this same curve — and that's how a single paper table can compute probabilities for the entire world.
In other words, it's not the final boss of statistics; it's the origin. Once you own this, the rest of the page reads as "applications of the standard normal".
スライダーで幅 k を伸び縮みさせると、青く塗られた面積がそのまま"確率"。
± 1σ ですでに約7割、± 2σ で95%、± 3σ でほぼ全部。
z = 1.96 という数字に見覚えがあれば、それは"両側5%"の臨界値。
検定も信頼区間もこの 1.96 から出発する — それくらい、この曲線が主役なのだ。
Slide the width k; the blue-filled area IS the probability.
± 1σ already covers ~68%, ± 2σ is 95%, ± 3σ is nearly everything.
That famous number z = 1.96? It's the two-tail 5% critical value — hypothesis tests and confidence intervals all start there.
身長、IQ、株価の日次リターン、工場の部品誤差 — 世の中にある正規分布っぽいものは平均も広がりもバラバラ。
でも z = (x − μ) / σ をかませるだけで、全部まとめてピンクのあの曲線にピタッと重なる。
スクロールしたら自動で変身していく(もう一度見たい時は ▶ ボタン)。これが、すべての統計公式が "標準正規表" 一枚で済む理由。
Height, IQ, daily stock returns, factory part errors — real-world normal-ish things all have different means and spreads.
Yet apply z = (x − μ) / σ and they all snap onto that pink curve.
It auto-plays on scroll (▶ to replay). That's why every statistical formula needs only one standard-normal table.
▼ この先の展開
ここから先に出てくる 中心極限定理 は「どんな分布でも平均は標準正規に近づく」という宣言。
信頼区間も 仮説検定 も "±1.96σ" というこの曲線の数字を使う。
t分布・χ²・F分布 は標準正規の兄弟姉妹。回帰の係数推定の誤差も標準正規で近似する。
要するに、この 1 ページを押さえると、他が全部"応用問題"になる。楽しんで。
▼ What comes next
The Central Limit Theorem ahead says: "any distribution's mean approaches the standard normal".
Confidence intervals and hypothesis tests all use the "±1.96σ" numbers from this curve.
t, χ², F are its siblings. Even regression coefficient errors are approximated with the standard normal.
Short version: nail this one page and the rest becomes "applications". Have fun.
ちょっとヤバい事実 — もとの分布がどんなに歪んでいても、
そこから n個 取って平均する操作を繰り返すと、その平均たちの分布は勝手に
ベル型(正規分布)に化ける。
下のラボでは 左=もとの分布(めっちゃ歪んでいる)、右=標本平均の分布(正規に化けていく)を並べて見せている。
n を大きくするほど、右のベルがシュッと細くなる(SE = σ/√n)。
Slightly outrageous fact — no matter how skewed the base distribution is,
if you take n samples and average, then repeat, the distribution of those averages
converges on its own to a bell (normal).
The lab below shows left = the raw skewed source side-by-side with right = the sample-mean distribution,
so you can watch the bell emerge. Crank n up and the bell tightens (SE = σ/√n).
さっきの標準正規の 一般バージョンが正規分布 N(μ, σ²)。
μ が位置(どこが真ん中か)、σ が広がり(どれくらい散らばるか)。
スライダーを動かすと曲線がぬるっと動いて、指定した区間 [a, b] に入る確率(ピンクの面積)が
リアルタイムで出る。
このピンクの面積こそ「割合」の正体。
たとえば成人男性の身長が N(170, 36)(平均170cm, σ=6cm)として、165〜175cm の人は全体の何%?
μ=170, σ=6 にして a=165, b=175 に合わせると 約 59.6%。
偏差値、テストの点、測定誤差——だいたい正規で近似できるものは、ぜんぶこの面積計算で「〜%の人がこの範囲」が求まる。
The general version of the standard normal is N(μ, σ²).
μ sets the center, σ sets the spread.
Slide the parameters and the curve glides; the probability of falling inside [a, b] (pink area) updates live.
That pink area IS the "percentage" you hear in the news.
Say adult male heights are N(170, 36) (mean 170cm, σ=6cm). What share falls in 165–175cm?
Set μ=170, σ=6, then a=165, b=175 — you get ≈ 59.6%.
Test scores, measurement errors, IQ — anything roughly normal gets its "X% of people in this range" from exactly this area.
Tip: drag directly on the graph to move the a/b bounds — whichever handle is closest follows your finger.
コイン投げで最初の10回連続で表が出た — これ、別に珍しいことじゃない。
でも 1万回投げたら、表の割合はほぼ ぴったり 0.5 に収まる。
これが大数の法則。サンプルを増やすほど、観測値は"真の値"に吸い寄せられていく。
統計が"なんとなく"じゃなく"証拠"になる理由がここにある。
10 heads in a row at the start of a coin-flip? Not that weird.
But flip it 10,000 times and the head-ratio locks onto almost exactly 0.5.
That's the Law of Large Numbers — the more samples you draw, the more observed values get pulled toward the truth.
This is why statistics counts as evidence, not a vague hunch.
95% 信頼区間って実はよく誤解される概念。
「真の値が95%の確率でここに入る」 …ではなくて、
「同じサンプリングを何百回も繰り返すと、そのうち約95%の区間が真の値を掴む」が正しい。
下のラボではそれをゴリ押しで実演する。ピンクの細い線が"捕まえられなかった不運な区間"。
全体のピンク比率が ちゃんと5%前後に落ち着くのを確認できたら、もう信頼区間は分かったも同然。
The 95% confidence interval is famously misunderstood.
It does NOT mean "the true value is inside with 95% probability". The correct reading:
"repeat this sampling many times, and ~95% of the resulting intervals will capture the true value".
The lab below brute-forces that intuition. Thin pink = the unlucky intervals that missed.
Once the pink share settles around ~5%, you've got it.
検定 = 裁判だと思うと超わかりやすい。
「H₀:この薬は効かない(=無罪)」をいったん仮置きし、データから計算した 検定統計量 z が
事前に決めた棄却域 に落ちたら有罪宣告 — つまり H₀ を棄却 する。
ここでは2画面で攻める:① z値と棄却域の幾何学(両側・右側・左側)・
② 冤罪(α)と見逃し(β)のトレードオフ。
Think of testing as a trial.
You start by assuming H₀ ("the drug has no effect" = "innocent"). Then if your computed test statistic z lands in the pre-chosen rejection region, you convict — that is, reject H₀.
Two panels below: ① geometry of z and rejection regions (two-sided, right, left), and ② false alarms (α) vs. misses (β).
検定には2種類の間違いがある。
第1種の誤り α: H₀ が本当なのに棄却してしまう(冤罪)。
第2種の誤り β: H₁ が本当なのに見逃してしまう(真犯人を逃す)。
そして 1 − β が検出力 (Power)。
効果量 δ(本当の差の大きさ)や α を動かすと、青(H₀)と紫(H₁)の曲線がせめぎ合い、
"間違いを減らすと見逃しが増える"というトレードオフが見える。
Testing has two kinds of mistakes.
Type I error α: rejecting H₀ when it's actually true (false alarm).
Type II error β: failing to reject H₀ when H₁ is actually true (a miss).
And 1 − β is the power.
Change effect size δ or α: the blue (H₀) and purple (H₁) curves fight it out — you can literally see the trade-off "fewer false alarms = more misses".
Tip: drag horizontally on the chart to slide the critical boundary (α).
t・χ²・F は、どれも正規分布から"作って"生まれた派生分布。
"もとは標準正規なんだけど、標本からしか情報を取れない現実"を反映するためにスケーリングしたもの、と思うとスッキリする。
ざっくり使い分けると —
t:母分散を知らずに平均を検定する時(=現実の平均検定はほぼ全部これ)。
χ²:分散そのものの検定、独立性や適合度(カテゴリカル)。
F:分散比の検定(分散分析 ANOVA、回帰の全体 F 検定)。
自由度 df を動かすと、t は df→∞ で N(0,1) に一致し、χ²/F は df が大きいほど対称なベル形に近づく。これ自体、裏では中心極限定理が効いている。
t, χ², F are all derived from the normal. Think of them as "the standard normal, scaled to reflect that we only ever see a sample".
Use them for: t — testing a mean when the population variance is unknown (i.e. nearly every real test of a mean);
χ² — testing a variance, independence, goodness-of-fit for categorical data;
F — ratios of variances (ANOVA, the overall F in regression).
Slide df: t converges to N(0,1) as df→∞, and χ²/F get more symmetric with more df. The CLT is quietly doing the work under the hood.
説明変数が1つだけの回帰が単回帰。x が1増えると y は β₁ だけ動く、という線形関係を仮定する。 最小二乗法は、全ての点との縦方向の差(残差)の二乗和を最小化する直線を選ぶ方法。 キャンバスをクリックすると点が追加され、回帰直線が"ぴろん"と動く。 緑のバーが残差。R² は「どれだけ直線で説明できたか」の指標(0〜1)。
Regression with just one explanatory variable is simple regression. It assumes a linear relationship: when x increases by 1, y moves by β₁. Ordinary least squares (OLS) picks the line that minimizes the sum of squared vertical residuals. Click the canvas to add points and watch the line snap into place. Green bars are residuals. R² (in 0–1) measures how much of y the line explains.
説明変数が2つ以上ある場合が重回帰。
x₁(例:勉強時間)と x₂(例:睡眠時間)から y(テスト点)を予測する、のように複数の要因を同時に扱う。
回帰"直線"ではなく、回帰平面になる。x₁ を1増やしたときの y への効果(他の変数を固定したうえで)が β₁、x₂ に対するのが β₂。
真のパラメータを設定してデータを生成し、推定された係数と真の値を比較しよう。
ドラッグでキャンバスを回転すると、平面とデータ点の立体構造が見える。
※ 可視化できるのは x₁, x₂ の 2 変数まで(人間の目は 3 次元が限界)。
でも数式上は ŷ = β₀ + β₁x₁ + β₂x₂ + β₃x₃ + … + βkxk といくらでも変数を足せる。
x₃ 以降は "グラフにできないだけ" で、推定の手続き β̂ = (XᵀX)⁻¹Xᵀy はそのまま機能する。
実務では 5〜50 変数くらいがごく普通。
With two or more explanatory variables, it's multiple regression.
Predict y (e.g., test score) from x₁ (study hours) and x₂ (sleep hours), handling several factors at once.
Instead of a regression line, you get a regression plane. β₁ is the effect on y of a unit change in x₁ holding x₂ fixed; β₂ is the same for x₂.
Set true parameters, generate data, and compare the estimates to the truth.
Drag the canvas to rotate and see the plane and data in 3D.
Note: only 2 predictors can be drawn (our eyes top out at 3-D).
But the equation keeps going — ŷ = β₀ + β₁x₁ + β₂x₂ + β₃x₃ + … + βkxk — you can add as many variables as you like.
From x₃ onward you just "can't draw it", but the estimator β̂ = (XᵀX)⁻¹Xᵀy works exactly the same.
In practice, 5–50 predictors is very normal.
「感度99%・特異度95%の検査で陽性」= 99%病気?
…答え:わずか 16.7%。医師でも半分以上が間違える超有名クイズ。
ポイントは"もともと病気の人がめっちゃ少ない"という事実を忘れてしまうこと。
下の"1000人の町"を見ながら、3つのつまみを動かして自分の目で確かめよう。
"The test has 99% sensitivity & 95% specificity, and you tested positive" — is there a 99% chance you're sick?
…Answer: only 16.7%. More than half of doctors get this classic quiz wrong.
The trick is that we forget how rare the disease actually is in the first place.
Play with the three sliders below and watch the "town of 1,000" — you'll see why.