2 분 소요

여러 분포들에 대한 소개

1. Definition

연속된 n번의 독립적 시행에서 각 시행이 확률 p를 가질 때(=베르누이 시행), 특정 횟수의 성공에 대한 확률 분포

📍베르누이 시행

  • 두 가지 결과가 있는 단일 시행
  • ex) 동전 던지기 -> {앞, 뒤}
  • n=1일 때 이행 분포는 베르누이 분포와 동일

2. PMF

\[f_x(x) = \binom{n}{x}p^x(1-p)^{n-x}\]
  • p: 성공 확률
  • n: 시행 횟수
  • x: 성공 횟수
  • $\binom{n}{x}$: 이항계수


📍조합

\[C(n, r) = \binom{n}{r} = \frac{n!}{r!(n-r)!}\]

📍순열

\[P(n, r) = \frac{n!}{(n-r)!}\]

📍독립

  • n개의 확률의 곱으로 표현
  • 서로 다른 사건의 확률을 곱할 수 있다는 것은 독립을 의미
\[\text{독립} : \, P(A \cap B) = P(A) \cdot P(B) \\ \text{일반} : \, p(A \cap B) = p(A) \cdot p(B | A)\]


📍 독립 항등 분포(i.i.d)

  • 각 독립 변수가 같으면서 (=항등)
  • 서로 영향을 미치지 않음 (=독립)


3. Theta

\[X \sim \text{Bin}(n, p) \\ \text{Bern}(p) = \text{Bin}(1,p)\]
  • p: 성공 확률
  • n: 시행 횟수

4. Summary statistics

  • Expectation: $np$
  • Variance: $np(1-p)$

5. Visualization

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import binom

def plot_binomial_distribution(n, p):
    x = np.arange(0, n+1)
    binomial_pmf = binom.pmf(x, n, p)

    plt.bar(x, binomial_pmf, color='skyblue')
    plt.ylim(0, 1)
    plt.title(f'Binomial Distribution (n = {n}, p = {p})')
    plt.xlabel('Number of Successes')
    plt.ylabel('Probability')
    plt.xticks(x)
    plt.grid(axis='y', linestyle='--', alpha=0.7)
    plt.show()

n = 10
probabilities = [0.1, 0.5]

for p in probabilities:
    plot_binomial_distribution(n, p)

👀 N이 충분히 크면??

  • n이 100 이상일 경우 정규분포와 유사함을 알 수 있음

📍 이항분포의 정규분포 근사 (feat CLT)

  • 중심극한정리(CLT)
\[\bar{X} \Rightarrow \frac {\sum {X_i}} {n} \rightarrow \text{Normal} \\ \sum {X_i} \rightarrow \text{Normal}\]
  • 표본 평균의 분포가 정규분포를 따를 때, n은 상수이므로 표본의 합 또한 정규분포를 따름
  • 이항분포는 베루누이 시행의 합 (=성공횟수)
\[X \sim B(n,p) \\ X = \sum{Y_i}\]
  • 즉, 베르누이 시행 결과 0, 1을 표본으로 생각할 때와 동일
  • 따라서 시행 횟수가 많아지면 정규분포에 근사하게 됨
  • 시행 횟수가 적으면 표본이 적은 것

📍이항분포의 포아송분포 근사

  • 확률변수 X가 $B(n,p)$ 분포를 따를 때, n이 크고, p가 작으며 $np=\lambda$를 만족하면 이항분포는 포아송분포로 근사됨
  • 보통 n이 20~30보다 크고, p가 0.05 보다 작은 경우
\[\lim_{n \rightarrow \infty} \binom{n}{x}p^x(1-p)^{n-x} = \frac {e^{-\lambda}\lambda^x}{x!}\]
  • 증명
\[\lim_{n \rightarrow \infty} \binom{n}{x}p^x(1-p)^{n-x} = \lim_{n \rightarrow \infty} \binom{n}{x} (\frac {\lambda} {n})^x (1 - \frac {\lambda} {n})^{n-x} \\ (np = \lambda, p = \frac {\lambda} {n}) \\ = \lim_{n \rightarrow \infty} \frac {n!} {x!(n-x)!} \cdot \lambda^x \cdot \frac {1}{n^x} \cdot (1-\frac {\lambda} {n})^n (1- \frac {\lambda} {n})^{-x} \\ = \lim_{n \rightarrow \infty} \frac {n!} {x!(n-x)!} \cdot \lambda^x \cdot \frac {1}{n^x} \cdot (1-\frac {\lambda} {n})^n \frac {n^x} {(n-\lambda)^x} \\ = \frac {\lambda^x} {x!} \cdot \lim_{n \rightarrow \infty} \frac {n!} {(n-x)!(n-\lambda)^x} \cdot (1-\frac{\lambda}{n})^n \\ = \frac {\lambda^x}{x!} \cdot 1 \cdot e^{-\lambda} \\ (\lim_{x \rightarrow \infty}(1 + \frac {a}{n})=e^{a}) \\ = \frac {e^{-\lambda}\lambda^x}{x!}\]
  • 스털링의 근사
\[\lim_{n \rightarrow \infty} \frac {n!} {(n-x)!(n-\lambda)^x} =1\]


\[1. \text{분자의 } n! \text{은 } n(n-1)(n-2)...(n-x+1) \text{과 } (n-x)! \text{으로 나뉘어 짐} \\ 2. \text{분자와 분모의 } (n-x)! \text{소거} \\ 3. (n-\lambda)^x \text{는 } n\text{이 무한대로 갈 때 } \lambda \text{보다 훨씬 크므로 } n^x \text{로 근사 }\]


\[\lim_{n \rightarrow \infty} \frac {n!} {(n-x)!(n-\lambda)^x} \approx \lim_{n \rightarrow \infty} \frac {n(n-1)(n-2)...(n-x+1)} {n^x} \\ = \lim_{n \rightarrow \infty} \frac {n}{n} \cdot \frac {n-1}{n} \cdot \frac {n-2}{n} ... \cdot \frac {n-x+1}{n} \\ = \lim_{n \rightarrow \infty} 1 \cdot (1-\frac {1}{n}) \cdot (1-\frac {2}{n}) ... \cdot (1-\frac {x-1}{n}) =1\]


\[n\text{이 무한대로 갈 때, } \frac {1}{n}, \frac {2}{n}, ... ,\frac {x-1}{n} \text{은 0으로 수렴}\]

댓글남기기