이번에 Markov Chain Monte Carlo(MCMC)를 배우면서 계속 생각했는데
도대체 왜 Bayesian에서는 MCMC를 그렇게 강조하는 것인가?
Bayesian Computation with R의 5장을 공부하면서도 그냥 막연하게 Rejection Sampling 배우네.. 엇 Importance Sampling 배우네.. 엇 SIR(Sampling Importance Resampling) 배우네... 하고 넘겼는데
6장 Markov Chain Monte Carlo Methods를 배우면서 왜 MCMC를 그렇게 강조했는지 알겠다!
Bayesian Statistics에서는 $$p(\theta | y) = \frac{f(y|\theta)p(\theta)}{\int f(y|\theta)p(\theta) d\theta}$$라는 수식을 통해 $y$를 update하는 개념을 사용해 데이터가 반영된 parameter distribution을 추정하는 것을 목표로 한다.
그런데 $\int f(y|\theta)p(\theta) d\theta$ 부분의 경우 추정 대상 parameter가 늘어남에 따라 막대한 계산량이 동반된다. 여기서 MCMC 기법이 사용되는 것이다.
그래서 MCMC(Markov Chain Monte Carlo)가 뭐냐면 Markov Chain property를 사용하여 simulation을 통해 $\int f(y|\theta)p(\theta) d\theta$ 부분을 계산하지 않아도 $p(\theta|y)$를 찾아낼 수 있는 방법을 말하는 것인데,
Markov Chain property에 따르면 Transition Probability Matrix가 Detailed Balance Equation을 만족한다면 n이 충분히 클 때 특정한 한 분포로 수렴하는데 Transition Probability Matrix를 Bayes' Thm의 Likelihood * Prior 부분(Density)으로 설정하면 Detaild Balance Equation(A Markov Chain is said to be reversible if there exists a probability distribution on $\pi$ on $\Omega$ such that$P(x | y)\pi(y) = P(y | x)\pi(x)$)을 만족시키면서 Stationary Distribution이 $P(\theta|y)$이 확률 과정 문제로 만들 수 있다. 이 때 확률과정의 샘플링을 충분히 한다면 샘플들의 분포는 모수 분포를 따르게 될 것이다.
그래서!!
직접 샘플링은 어렵지만, Markov Chain을 잘 설계해서 결국 우리가 원하는 분포에 도달하도록 만들자.
라는 것인데,
즉, 어떤 초기 state에서 출발하여
Transition Matrix와 같은 rule에 입각하여 따라가면
Posterior과 비슷한 Stationary distribution을 따르는 Markov Chain을 만들 수 있다.
그래서 이 Stationary distribution에서 Sampling을 하면 이게 곧!! Posterior Sample이 되는 것이다.
아하..
이제 왜 배우는지 알고 나니깐 더 열심히 해야겠다는 생각이 든다.
방학 때 꼭 Bayesian Computation with R 끝내보자...!!!!
'통계학 > 베이지안(Bayesian)' 카테고리의 다른 글
| Estimate, Estimator, Frequentist, Bayesian (0) | 2025.09.05 |
|---|---|
| Bayesian Linear Regression By Gibbs sampling(Matrix) - 수정 (0) | 2025.09.04 |
| Bayesian Simple linear Regression by Gibbs sampling (0) | 2025.08.04 |
| Bayes Rule (0) | 2025.05.19 |
| Bayesian Linear Regression (0) | 2025.05.19 |