条件付け、ベイズ推定およびサンプリング誤差
導入済み
5:04
T.8 · 条件付け、ベイズ推定およびサンプリング誤差
この単元では、条件付き確率・結合確率・独立事象の確率を分離し、完全なベースレート表を用いて事後確率を計算し、利用する。
英語のナレーション・英語と中国語の字幕を切り替え可能
このレッスンの内容
| English | 意味 |
|---|---|
| standard error/ˈstændəd ˈerə/ | 標準誤差 |
| unconditional probability | |
| independence/ˌɪndɪˈpendəns/ | The condition in which learning about one event or variable does not change the probabilities associated with another. |
| mutual independence | |
| sample space/ˈsæmpl speɪs/ | The set of all possible outcomes of a random experiment. |
| sensitivity/ˌsensɪˈtɪvɪti/ | 感度 |
| specificity/ˌspesɪˈfɪsɪti/ | 特異性 |
| conditional independence/kənˈdɪʃənl ˌɪndɪˈpendəns/ | |
| standard deviation/ˈstændəd ˌdiːvɪˈeɪʃn/ | A measure of spread equal to the square root of the variance. |
| variance/ˈveərɪəns/ | A measure of spread based on the squared deviations of values from their mean. |
| central limit theorem/ˈsentrəl ˈlɪmɪt ˈθɪərəm/ | |
| covariance/ˈkɒveərɪəns/ |
陽性テスト、希な状態
- あるモデルテストの感度は90%、特異度は95%であり、人口の2%にその状態がある。陽性結果を得た人のうち、実際にその状態を持っているのは約27%に過ぎない。高い検出率は、陽性結果が正しい確率という異なる問いに対する答えではない。
- 条件付き後の人口を追跡し、観測値のばらつきと平均の標準誤差を区別する。以下の検出率は仮想的な数学的入力である。
条件付けは分母を変える
- For events $A,B$ with $P(B)>0$, define $P(A\mid B)=\dfrac{P(A\cap B)}{P(B)}$. The denominator restricts attention to $B$; the numerator keeps outcomes that also satisfy $A$. The elementary formula does not define conditioning on a zero-probability event.
- 公平なサイコロを振る。事象$A=\{4,5,6\}$と$B=\{2,4,6\}$とする。すると$P(A\cap B)=2/6$かつ$P(B)=3/6$となり、$P(A\mid B)=2/3$が得られる。無条件確率$P(A)=1/2$は全6つの結果を用いる。
$P(A \cap B) = 0.12$ かつ $P(B) = 0.3$. Find $P(A \mid B)$.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
P(A | B) = P(A ∩ B) / P(B) = 0.12 / 0.3 = 0.4.
条件付きパスに沿って掛け合わせる
- 定義を整理すると$P(A\cap B)=P(B)P(A\mid B)$となる。3つの事象については、まず$P(A)$から始め、次に$P(B\mid A)$と$P(C\mid A\cap B)$を掛け合わせる。各条件付け事象は正の確率を持つ必要がある。
- 標準的な52枚のデッキから交換なしで2枚のカードを引く。エースが2枚出る確率は$\dfrac4{52}\cdot\dfrac3{51}=\dfrac1{221}$である。最初のエース後、残りの51枚の中にエースは3枚だけある。変化しない2つの確率を掛け合わせると、実際には存在しない独立性を仮定してしまう。
A first card drawn from a standard 52-card deck is an ace and is not replaced. Find the probability the second is an ace, to three decimal places.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Three aces remain among 51 cards, so the conditional probability is 3/51=1/17≈0.059.
独立性は厳密な恒等式である
- 事象$P(A\cap B)=P(A)P(B)$が成り立つとき、それらは独立である。$P(B)>0$であれば、これは$P(A\mid B)=P(A)$と同等である。いずれかの事象の確率がゼロであっても、積の定義は有効である。
- With $P(A)=0.4$, $P(B)=0.5$, and $P(A\cap B)=0.3$, the conditional probability is $0.6$, so the events are dependent. In contrast, marginals $0.5$ and $0.4$ with intersection $0.2$ satisfy independence exactly.
If $P(A) = 0.5$, $P(B) = 0.4$ かつ $P(A \cap B) = 0.2$, then $A$ かつ $B$ are independent.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
True. A and B are independent exactly when P(A ∩ B) = P(A)P(B), and 0.5 × 0.4 = 0.2.
排反は独立を意味しない
- 排反な事象は$A\cap B=\varnothing$を持つ。両方が正の確率を持つ場合、独立ではありえない:交りの確率はゼロだが、積は正である。公平なサイコロにおいて、「奇数」と「偶数」は排反であり、かつ従属している。
- Independence of every pair need not give mutual independence. For two fair independent coin tosses, let $A$ mean first toss heads, $B$ mean second toss heads, and $C$ mean the tosses agree. Every pair has intersection probability $1/4$. The triple also has probability $1/4$, whereas mutual independence would require $1/8$.
Two disjoint events, each with positive probability, can be independent.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Their intersection has probability zero but the product of their probabilities is positive.
For a fair die, let $A=\{4,5,6\}$ かつ $B=\{2,4,6\}$. Find the intersection and both conditional probabilities. Are the events independent or disjoint?
モデルに対して、条件付けグループ、仮定、および計算を確認せよ。
完全分割に沿って足し合わせる
- 事象$B_1,\ldots,B_k$が排反で、標本空間を被覆し、それぞれが正の確率を持つなら、$P(A)=\sum_i P(B_i)P(A\mid B_i)$が成り立つ。各項は$A$への排反な経路の一つであり、いかなる結果も欠落したり重複してカウントされたりしない。
- 工場のライン1から部品の60%、ライン2から40%を仕入れている。欠陥率はそれぞれ1%と3%である。全体としての欠陥確率は$0.6(0.01)+0.4(0.03)=0.018$であり、単純な平均$0.02$ではない。
検出率の名称に注意
- $D$を「状態が存在する」、$+$を「陽性結果」とする。感度は$P(+\mid D)$、特異度は$P(-\mid\bar D)$である。偽陽性率は$P(+\mid\bar D)=1-\text{specificity}$となる。
- 陽性予測値は$P(D\mid +)$であり、これは異なる条件付けに基づいている。感度や特異度だけではこの確率を与えられず、ベースレート$P(D)$も重要である。
四つのセルをすべて作成する
- モデル人口10,000において、ベースレート2%により、状態を持つ者は200人、持たない者は9,800人である。感度90%により、真陽性は180人、偽陰性は20人となる。特異度95%により、真陰性は9,310人、偽陽性は490人となる。
- 陽性結果は$180+490=670$件、陰性結果は$20+9310=9330$件ある。したがって$P(D\mid +)=180/670\approx26.9\%$となる。検出率90%は$180/200$であり、分母が異なる。
The given group changes the denominator
$P(A\mid B)=n(A\cap B)/n(B),\quad n(B)>0$
Use the lesson’s table to compare a conditional probability, its reverse and a whole-cohort probability. The highlighted group is the denominator.
ベイズの定理で条件付けを逆転させる
- $u=P(D)P(+\mid D)$と$v=P(\bar D)P(+\mid\bar D)$を記述する。全確率の法則により$P(+)=u+v$が得られる。これが正であれば、ベイズの定理により$P(D\mid +)=\dfrac{u}{u+v}$が得られる。
- ベースレート10%、感度80%、特異度90%の場合、陽性への二つの経路は$u=0.10(0.80)=0.08$と$v=0.90(0.10)=0.09$である。事後確率は$0.08/0.17=8/17\approx0.471$となり、単なる感度$0.8$ではない。
それはどの確率か。
条件付き確率の記述が指すものを名付けよ。
Prevalence 10%, sensitivity 80%, specificity 90%. Find $P(D \mid +)$ to three decimal places.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
The positive routes are 0.10×0.80=0.08 and 0.90×0.10=0.09, so the posterior is 0.08/(0.08+0.09)=8/17≈0.471.
ベースレートを変えて検診を維持する
- 感度を90%、特異度を95%のままに保ち、ベースレートを2%から20%に引き上げる。10,000人あたり、陽性者数は真陽性1,800人と偽陽性400人となり、今では$P(D\mid +)=1800/2200\approx81.8\%$となる。
- 検診の二つの条件付き確率は一定のままだが、対象者の構成が変わった。逆に、ベースレートを2%に保ちつつ特異度を99%に上げると、偽陽性を98人に減らし、$180/278\approx64.7\%$を得る。
In a hypothetical batch, 4% of parts are defective. A checker flags 95% of defective parts and 2% of nondefective parts. Build a table for 10,000 parts and find the probability a flagged part is defective.
モデルに対して、条件付けグループ、仮定、および計算を確認せよ。
陰性結果と反復結果
- In the original 2% model, $P(D\mid -)=20/9330\approx0.00214$. Its complement is $P(\bar D\mid -)$, not $P(D\mid +)$: both probabilities in a complement must condition on the same event.
- 検診を繰り返すことは、誤り率を自動的に二乗することにはならない。偽陽性率を二乗するには、条件付き独立(状態がない場合)が必要であり、感度の積を取るにも同様に条件付き独立(状態がある場合)が必要である。共通の誤り要因はこれらの仮定を破る可能性がある。
In the original hypothetical 2% model, 20 of the 9,330 negative results have the condition. Find the probability of the condition given a negative result, to six decimal places.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
The negative result defines the denominator: 20/9330≈0.002144. This is not the false-negative rate 20/200.
When can two test false-positive rates of 0.05 be multiplied to obtain a joint false-positive rate of 0.0025?
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
The multiplication is within the group without the condition, so independence must hold conditional on absence, with each conditional rate 0.05. Merely using the same test or a new day does not establish it.
平均自体にも分布がある
- 標本抽出前において、観測値$X_1,\ldots,X_n$とそれらの平均$\bar X$は確率変数である。標本抽出を繰り返すと、可能な平均値の標本分布が得られる。その標準偏差は平均の標準誤差である。
- 各観測値の平均が$\mu$であれば、線形性により$E(\bar X)=\mu$が得られ、独立性はこの期待値には必要ない。実際に得られた標本平均$\bar x$は一つの値であり、標本分布全体ではない。
標準誤の導出
- $\bar X=\frac1n\sum_iX_i$ とする。観測が独立であり、かつ有限の分散 $\sigma^2$ を持つと仮定する。和の分散は $n\sigma^2$ であり、平均を取ることでこれを $n^2$ で割る。したがって $\operatorname{Var}(\bar X)=\sigma^2/n$ となり、平方根をとれば $\operatorname{SE}(\bar X)=\dfrac{\sigma}{\sqrt n}$ が得られる。
- 独立同分布で有限の分散を持つ観測値はこれらの仮定を満たすが、正規性が必要になるわけではない。分散が異なる独立変数の場合、平方根を取る前にそれらの和を $n^2$ で割る必要がある。
個々のばらつきと平均のばらつきの違い
- $\sigma=12$ のとき、36 個の観測値の平均の標準誤(SE)は $2$ であり、144 個の平均の標準誤は $1$ である。個々の観測値の標準偏差は依然として $12$ のままである。サンプルサイズを増やすことは、個々の観測値の変動を小さくするのではなく、平均を安定させることである。
- $\sigma$ が未知の場合、標準誤を $s/\sqrt n$ で推定できる。ここで $s$ は標本標準偏差である。$s=18$ と $n=81$ の場合、推定量は $2$ となる。これはデータに基づく推定値であり、既知の母集団パラメータではない。
Individual spread and sample-mean spread
$\mathrm{SD}(\bar X)=\sigma/\sqrt n$
Changing n changes the standard error, not the population standard deviation. Normal probabilities require an explicit distribution model.
Each of 100 independent observations has standard deviation $\sigma=20$. What is the standard error of their mean?
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
The standard error of the mean is σ/√n = 20/√100 = 20/10 = 2.
For an iid sample of size $81$ with sample standard deviation $s=18$, estimate the standard error of the sample mean.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Use s/√n=18/9=2. This estimates the unknown population SE.
サンプルサイズの計画
- 観測の分散とサンプリングの仮定を一定に保ったまま、$n$ を $k$ 倍すると SE は $1/\sqrt k$ 倍になる。サンプル数を四倍にすれば SE は半減し、SE を三分の一にするには、観察数を九倍にする必要がある。
- $\sigma$ が既知のとき、標準誤を最大でも $e>0$ に抑えるには、条件 $n\ge(\sigma/e)^2$ を満たし、小数点以下を切り上げて整数とする。$\sigma=10$ で目標の標準誤が $3$ の場合、これにより $n\ge100/9$ となり、最小必要数は $12$ であり、$11$ ではない。
Holding the common observation variance fixed for independent observations, multiplying the sample size by 4 changes the mean standard error by a factor of
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
√4 = 2 in the denominator.
Independent observations have common standard deviation $\sigma=10$. What is the smallest integer sample size giving mean SE at most $3$?
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
n must be at least (10/3)²=100/9≈11.111; round up to 12. At n=11 the SE is still larger than 3.
Two independent observations have the same mean $\mu$ and variances $9$ かつ $16$. Find the mean and standard error of their average. Explain why a common-$\sigma$ shortcut is inappropriate.
モデルに対して、条件付けグループ、仮定、および計算を確認せよ。
正確なばらつきは必ずしも正規性を意味しない
- 独立正規観測値であれば、どのようなサンプルサイズにおいても平均は正規分布に従う。一方、有限の正の分散を持つ独立同分布観測値については、中心極限定理により、$n$ が大きくなるにつれて標準化された平均が近似正規分布に従うことが保証されるのみであり、個々の観測値自体が正規分布になるわけではない。
- $n$ 個の独立ベルヌーイ観測値の平均は、$n+1$ 種類の値しか取り得ないため、正確には正規分布に従わない。しかし、標準誤の公式はそのまま成立する。すべての母集団に対して正確な正規近似を保証するuniversalなサンプルサイズは存在しない。
The mean of any finite iid sample with finite variance has an exactly normal distribution.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
For Bernoulli observations a finite sample mean is discrete. The standard error identity can be exact while a normal approximation is only approximate.
相関とバイアスには別々の検証が必要
- 相関のある観測値の場合、分散には共分散項が含まれる。分散が $\sigma^2$ で共分散が $c$ である2つの観測値の平均の分散は $(\sigma^2+c)/2$ となる。もし2つ目が完全に同一のランダム読み取りを繰り返すなら、$c=\sigma^2$ であり、平均を取ってもばらつきの減少はない。
- 小さい標準誤はサンプリングのばらつきを表すものであり、バイアスを表すものではない。本来バイアスのない測定値に常に $3$ を加えるセンサーでは、サンプルサイズがいくら大きくても平均は $3$ のバイアスを持つ。単に繰り返し測定をしても、この系統的なずれは解消されず、非代表性のあるサンプルの欠陥も修復されない。
どの数量が変わるか?
個別観測ばらつき、標本ばらつき、バイアス
Suppose $X_i=\mu+3+Z+\varepsilon_i$, where $Z$ has mean zero and variance 4, the $\varepsilon_i$ are independent with mean zero and variance 9, and $Z$ is independent of every error. Find the mean and variance of $\bar X$ and describe what increasing $n$ can fix.
モデルに対して、条件付けグループ、仮定、および計算を確認せよ。
復習
- 感度: 病気が実際に存在している場合に検査結果が陽性となる確率。
- 特異度: 病気が実際に存在していない場合に検査結果が陰性となる確率。
- 標準誤: 統計量のサンプリング分布の標準偏差。独立で共通分散を持つサンプル平均においては $\sigma/\sqrt n$ であり、$\sigma$ が未知のときには $s/\sqrt n$ で推定される。相関、近似の仮定、バイアスについては別々に確認する。
何が問題でしたか?この内容はサイトの運営チームだけが確認します。