Conditional Probability, Bayes' Theorem, Expectation, and the Normal Distribution TODO
Concept
Conditional probability P(A|B) is the probability of A given that B has occurred, defined as P(A and B) divided by P(B). Bayes' theorem, P(A|B) = P(B|A)P(A)/P(B), gives the procedure for updating a prior probability with the likelihood of new evidence to get a posterior probability. Expectation is a probability-weighted average, and by linearity the expectation of a sum equals the sum of expectations even when the variables aren't independent — though variance only adds simply when the variables are uncorrelated. The normal distribution is determined entirely by its mean and variance, and it serves as the default model because of the central limit theorem: summing many independent random variables with finite variance produces a sum whose distribution approaches normal. That said, assuming normality for fat-tailed data — like financial returns — badly underestimates the probability of extreme events.
When the base rate is low, even a highly accurate detector produces mostly false positives among its positive calls — a Bayesian conclusion that overturns naive intuition in practice — and a prediction market's price is itself best read as a posterior probability.
Code & Formula
# Day 35 — 조건부확률·베이즈·기대값·정규분포
# 질병 검사 예시로 베이즈 정리를 수치로 계산: P(질병|양성) = P(양성|질병)P(질병) / P(양성)
prior_disease = 0.01 # P(질병) — 사전확률(유병률)
p_positive_given_disease = 0.95 # P(양성|질병) — 민감도
p_positive_given_healthy = 0.05 # P(양성|건강) — 위양성률
p_healthy = 1 - prior_disease
p_positive = (p_positive_given_disease * prior_disease
+ p_positive_given_healthy * p_healthy)
p_disease_given_positive = (p_positive_given_disease * prior_disease) / p_positive
print(f"사전확률 P(질병) = {prior_disease}")
print(f"P(양성) (전체확률) = {p_positive:.4f}")
print(f"베이즈 정리로 계산한 P(질병|양성) = {p_disease_given_positive:.4f}")
print("-> 검사가 정확해 보여도 유병률이 낮으면 사후확률은 여전히 낮다는 직관을 확인한다.\n")
# 기대값과 정규분포: 표준정규분포에서 표본을 뽑아 표본평균이 이론적 기대값(0)에 가까워짐을 확인
import random
random.seed(42)
n = 100_000
samples = [random.gauss(mu=0, sigma=1) for _ in range(n)]
sample_mean = sum(samples) / n
sample_var = sum((s - sample_mean) ** 2 for s in samples) / n
print(f"N(0,1)에서 {n}개 표본 추출")
print(f"표본평균 = {sample_mean:.6f} (이론값 0)")
print(f"표본분산 = {sample_var:.6f} (이론값 1)")
Exercise
For an event with a 1% base rate, detected by a test with 99% sensitivity and 99% specificity, compute by hand the probability that a positive result is actually correct, then verify it with 100,000 simulation runs.
Practical Connection
Verex's market prices are read as participants' posterior probability estimates, and LMSR's per-outcome prices are always maintained as a probability vector summing to 1 — so getting this probabilistic language exactly right is what keeps P&L and settlement calculations from going wrong.
Where it lands in Jayverse
- Verex: set any resolution-side anomaly alert threshold from the actual base rate. A "99% accurate" suspicious-settlement detector on a rare event still produces mostly false positives, so compute the real base rate before trusting alert volume.
- Auditor: apply the same base-rate correction to Tenderly/invariant alerts. Log the false-positive rate against the true incident base rate before treating alert frequency as signal.
- Number: flag normality assumptions on fat-tailed data before publishing. Any Number model that assumes a normal distribution on return-like data should state how much it underestimates tail risk.
Key expressions
| Expression | 뜻 · 쓰이는 자리 |
|---|---|
| posterior probability | 사후 확률 · 새 증거를 반영해 갱신한 확률을 가리킬 때. "to get a posterior probability." |
| by linearity | 선형성에 의해 · 독립성과 무관하게 성립하는 기댓값의 성질을 말할 때. "by linearity the expectation of a sum equals" |
| uncorrelated | 상관관계가 없는 · 두 변수 사이에 통계적 연관이 없을 때. "when the variables are uncorrelated" |
| fat-tailed | 두꺼운 꼬리 분포의 · 극단적 사건의 확률이 정규분포보다 큰 데이터를 가리킬 때. "fat-tailed data — like financial returns" |
| badly underestimate | 심하게 과소평가하다 · 실제보다 훨씬 낮게 추정할 때. "badly underestimates the probability of extreme events." |
| base rate | 기저율, 사전 발생 확률 · 베이즈 추론에서 사건의 기본 빈도를 말할 때. "When the base rate is low" |
| overturn naive intuition | 순진한 직관을 뒤엎다 · 통계적으로 반직관적인 결론이 나올 때. "overturns naive intuition in practice" |
If you study this on a given day, add a note link and a ✅ to this line in the source curriculum (docs/knowledge/math-50-curriculum.md) and this spot will lead straight to the note body. You can also write directly on this page — but regenerating overwrites it, so it's safer to keep anything you want to save as markdown under docs/algorithms/.