標準正規分布 — すべてのはじまり
Standard Normal — The Origin of Everything
初めてこのページに来た方へ
前提知識は不要です。ここが統計学の出発点。「ベルカーブ」という言葉を聞いたことがあれば十分です。New here?
No prerequisites. This is the starting point. If you've heard "bell curve," you're ready.
ぶっちゃけ この曲線ひとつがなければ、
この先に出てくる検定も、信頼区間も、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".
▶ 「68 - 95 - 99.7」は暗記じゃなくて見て分かる
▶ "68 - 95 - 99.7" — no memorization, just see it
スライダーで幅 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.
▶ 正規分布、ぜんぶ"あの一本"に化ける瞬間
▶ Watch every normal collapse onto "that one curve"
身長、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.
正規分布と標準化
Normal Distribution & Standardization
初めてこのページに来た方へ
標準正規分布(N(0,1)、平均0・標準偏差1のベルカーブ)を知っていると理解しやすいです。New here?
Easier if you know the standard normal (N(0,1), bell curve with mean 0, sd 1).
さっきの標準正規の 一般バージョンが正規分布 N(μ, σ²)。
μ が位置(どこが真ん中か)、σ が広がり(どれくらい散らばるか)。
スライダーを動かすと曲線がぬるっと動いて、指定した区間 [a, b] に入る確率(ピンクの面積)が
リアルタイムで出る。
このピンクの面積こそ「割合」の正体。
たとえば成人男性の身長が N(170, 36)(平均170cm, σ=6cm)として、165〜175cm の人は全体の何%?
μ=170, σ=6 にして a=165, b=175 に合わせると 約 59.6%。
偏差値、テストの点、測定誤差——だいたい正規で近似できるものは、ぜんぶこの面積計算で「〜%の人がこの範囲」が求まる。
Tip: グラフ上を直接ドラッグすると、近い方の a/b の境界を動かせる。
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.
確率の基本法則 — ベン図で直感をつかむ
Probability Rules — Build Intuition with Venn Diagrams
初めてこのページに来た方へ
正規分布の知識は不要です。高校の「場合の数と確率」の延長で読めます。New here?
No normal distribution knowledge needed. This extends high school probability.
加法定理、乗法定理、条件付き確率 — 公式を暗記する前に、面積で「見て」しまおう。
P(A∪B) = P(A) + P(B) − P(A∩B) は「2つの円を重ねた面積から、重なりを引く」だけ。
条件付き確率 P(A|B) は「B の円の中で A が占める割合」。
独立ボタンを押すと P(A∩B) = P(A)·P(B) に自動調整 — 独立ってこういうこと。
Addition rule, multiplication rule, conditional probability — see them as areas before memorizing formulas.
P(A∪B) = P(A) + P(B) − P(A∩B) is just "area of two circles minus the overlap."
Conditional probability P(A|B) is "the fraction of B's circle occupied by A."
Press the Independence button to snap P(A∩B) = P(A)·P(B) — that's what independence means.
52枚のトランプから1枚引く。A = ハートが出る(13/52 = 0.25)、B = 絵札が出る(12/52 ≈ 0.23)。
A∩B = ハートの絵札(3/52 ≈ 0.06)。→ P(A∪B) = 0.25 + 0.23 − 0.06 = 0.42。
独立の例:サイコロ2個。A = 1個目が偶数、B = 2個目が3以上。1個目の結果は2個目に影響しないので独立。P(A∩B) = 1/2 × 2/3 = 1/3。
Draw one card from a 52-card deck. A = heart (13/52 = 0.25), B = face card (12/52 ≈ 0.23).
A∩B = heart face card (3/52 ≈ 0.06). → P(A∪B) = 0.25 + 0.23 − 0.06 = 0.42.
Independence example: two dice. A = 1st is even, B = 2nd is ≥3. The 1st roll doesn't affect the 2nd, so independent. P(A∩B) = 1/2 × 2/3 = 1/3.
▶ インタラクティブ・ベン図
▶ Interactive Venn Diagram
離散分布と指数分布
Discrete & Exponential Distributions
初めてこのページに来た方へ
正規分布の基本的な形を知っていればOK。ここでは正規分布以外の分布を3つ学びます。New here?
Just knowing the basic normal distribution shape is enough. Here we learn 3 other distributions.ベイズの定理
Bayes' Theorem
初めてこのページに来た方へ
条件付き確率 P(A|B) の意味を知っていると理解しやすいです。知らなくても、スライダーを触れば直感的にわかります。New here?
Easier if you know conditional probability P(A|B). But even without it, the sliders make it intuitive.
「感度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.
サンプルから母集団を推測する
Statistical Inference — learning about populations from samples
中心極限定理
Central Limit Theorem
初めてこのページに来た方へ
「正規分布」と「平均」の意味がわかっていれば大丈夫です。ここでは「なぜ平均は正規分布になるのか」を体験します。New here?
If you know "normal distribution" and "mean," you're set. Here you'll see WHY the mean becomes normal.
ちょっとヤバい事実 — もとの分布がどんなに歪んでいても、
そこから 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).
大数の法則
Law of Large Numbers
初めてこのページに来た方へ
CLT を見ていなくても大丈夫。「コインを何万回も投げると表の割合は50%に近づく」— それがこのページのすべて。New here?
Haven't seen CLT? That's fine. "Flip a coin 10,000 times and the heads ratio approaches 50%" — that's this page.
コイン投げで最初の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.
信頼区間
Confidence Interval
初めてこのページに来た方へ
「標本平均」と「標準偏差」の意味がわかっていればOK。ここでは推定の不確実性を「幅」で表現する方法を学びます。New here?
If you know "sample mean" and "standard deviation," you're ready. Here we express estimation uncertainty as a "width."
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.
仮説検定
Hypothesis Testing
初めてこのページに来た方へ
信頼区間の考え方と正規分布の基本がわかると理解しやすいです。「p値」は聞いたことがあるレベルでOK。New here?
Easier with confidence intervals and basic normal distribution. Having heard of "p-value" is enough.
検定 = 裁判だと思うと超わかりやすい。
「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 (β).
▶ ① 基本:z値と棄却域
▶ ① Basics: z-statistic & rejection region
▶ ② 2つの誤り:α・β・検出力
▶ ② Two kinds of errors: α, β, power
検定には2種類の間違いがある。
第1種の誤り α: H₀ が本当なのに棄却してしまう(冤罪)。
第2種の誤り β: H₁ が本当なのに見逃してしまう(真犯人を逃す)。
そして 1 − β が検出力 (Power)。
効果量 δ(本当の差の大きさ)や α を動かすと、青(H₀)と紫(H₁)の曲線がせめぎ合い、
"間違いを減らすと見逃しが増える"というトレードオフが見える。
Tip: グラフ上を左右にドラッグすると、臨界値(α の境界)を直接動かせる。
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 (α).
三大検定分布
The Three Test Distributions
初めてこのページに来た方へ
標準正規分布と仮説検定の基本を知っていると理解しやすいです。「母分散がわからないとき、どうするか」がテーマです。New here?
Easier with standard normal and hypothesis testing basics. The theme: "what happens when population variance is unknown."
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.
▶ t distribution
使いどころ: 母分散未知の平均検定、回帰係数の t 値。
例:クラス30人の平均点が全国平均と違うか調べるとき。
クセ: 正規より裾が重い(外れ値に優しい)。df→∞ で N(0,1)。
Use for: testing means with unknown variance, regression t-values.
Flavor: heavier tails than N(0,1); matches N(0,1) as df→∞.
▶ χ² distribution
使いどころ: 分散の検定、独立性/適合度のカイ二乗検定。
例:サイコロの出目が均等か、アンケートの「はい/いいえ」に偏りがないか調べるとき。
クセ: 非負・右に歪む。平均 = k、分散 = 2k。df大で正規ベル化。
Use for: variance tests, chi-square tests of independence / goodness-of-fit.
Flavor: non-negative, right-skewed. Mean = k, variance = 2k. Goes bell-shaped with large df.
▶ F distribution
使いどころ: 分散分析(ANOVA)、回帰モデルの全体 F 検定。
例:3クラスの平均点に差があるか調べるとき(一元配置分散分析)。
クセ: 非負・右歪み。分子/分母の df で形が変わる。
Use for: ANOVA, overall F-test in regression.
Flavor: non-negative, right-skewed. Shape depends on both df.
カイ二乗検定
Chi-Squared Test
適合度検定は「観測されたカテゴリ分布は、理論分布と合っているか?」を調べる。サイコロが公正かどうか、が典型例。
独立性検定は「2つのカテゴリ変数は独立か?」を調べる。クロス集計表の各セルで期待度数とのズレを計算し、χ² = Σ (O−E)²/E を合計する。
なぜ E で割る? → 「期待10人に対して2人のズレ」と「期待1000人に対して2人のズレ」は重みが違う。E で割ることで相対的なズレに揃えている。
どちらも χ²分布に従う統計量を使い、右裾の面積が p 値になる。自由度は適合度なら k−1、独立性なら (r−1)(c−1)。
Goodness-of-fit asks: "Does the observed category distribution match a theoretical one?" Classic example: is the die fair?
Test of independence asks: "Are two categorical variables independent?" Compute χ² = Σ (O−E)²/E across every cell of the contingency table.
Why divide by E? → A deviation of 2 from an expected 10 matters more than 2 from an expected 1,000. Dividing by E turns raw gaps into relative ones.
Both use a χ²-distributed statistic; the p-value is the right-tail area. df = k−1 for goodness-of-fit, (r−1)(c−1) for independence.
▶ ① 適合度検定 — サイコロは公正か?
▶ ① Goodness-of-Fit — Is the Die Fair?
▶ ② 独立性検定 — 2変数は独立か?
▶ ② Test of Independence — Are Two Variables Independent?
関係を見つけ、予測する
Modeling — finding relationships and making predictions
単回帰分析(最小二乗法)
Simple Regression (OLS)
初めてこのページに来た方へ
「平均」「標準偏差」「相関」の意味がわかればOK。中学の「y = ax + b」を思い出せれば完璧。New here?
If you know "mean," "standard deviation," and "correlation," you're set. Remember y = ax + b from school? Perfect.説明変数が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.
重回帰分析
Multiple Regression
初めてこのページに来た方へ
単回帰(1本の直線を引く)を知っていると理解しやすいです。ここでは直線が「平面」に拡張されます。New here?
Easier if you know simple regression (fitting one line). Here the line extends to a "plane."
説明変数が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.
- Step 1: ノイズ σ を 0 にして再サンプリング → 推定値と真の値がぴったり一致することを確認。
- Step 2: σ を 0.5 に上げる → 推定値が真の値からズレ始める。何度か再サンプリングして、推定値のバラつきを見よう。
- Step 3: n を 10 にして再サンプリング → 推定が不安定。n を 200 にすると安定する。これが大数の法則。
- Step 4: β₁ を 0 にする → x₁ は y に影響しない。推定 β̂₁ が 0 に近いか確認しよう。
- Step 1: Set noise σ to 0 and resample → estimates match the true values exactly.
- Step 2: Raise σ to 0.5 → estimates start drifting. Resample several times to see the variation.
- Step 3: Set n to 10 and resample → unstable. Set n to 200 → stable. That's the law of large numbers.
- Step 4: Set β₁ to 0 → x₁ has no effect on y. Check that estimated β̂₁ is close to 0.