Bayesian Estimation(베이지안 추정)
이전에 여러 estimator를 비교할 때 단순히 risk를 활용하여 비교했더니, unknown parameter $\theta$의 true value가 어떻냐에 따라 estimator의 선택이 달라져야 했음을 다룬 바 있다(Mathematical statistics - Sufficiency편 참조). 이를 해결하기 위해 frequentist가 했던 방법은 unbiased estimator에 집중하는 것이었다. Unbiasedness의 통계적 의미가 크다고 느꼈던 frequentist의 관점에서, 마침 risk도 squared loss 아래에서 variance에 불과하므로 esimator들끼리의 risk 비교가 수월하기에 unbiased estimator는 그들에게 상당히 매력적이었을 것이다. 이번 편에서는 Bayes 관점에서 어떻게 risk를 가지고 최적의 estimator를 선택할 수 있을지 소개한다. 그 전에 Bayes가 통계적 분석을 할 때 기저가 되는 철학을 먼저 알아보자.
Bayesian의 inference에서는 $\theta$에 대한 estimation이나 future observation을 predict할 때 모두 probability statement로 나타낸다. Probability를 어떤 event의 uncertainty로 받아들이기 때문에 그들의 inference 방법론들의 결과가 probability에 대한 것들로 표현이 되었다면, 그 probability는 실제로 그 event가 나타날 불확실성이며 그 값이 클 수록 그 event가 발생할 실질적인 가능성이 커진다. 이러한 점에서 frequentist와는 다른 관점을 보유하고 있다고 생각해도 되는데, frequentist는 probability를 어떤 sample를 무한정 뽑을 때 특정 event가 나타나는 빈도를 나타내기 때문이다.
여기서 가장 중요한 assumption은 unknown parameter $\theta$에 대한 정보도 하나의 probability distribution으로 표현한다는 것이다.
- Data가 수집되기 전, 우리는 어느 정도 알고 있는 $\theta$에 대한 정보를 이용하여 uncertainty를 probability distribution으로 표현한다. 가령, 어떤 특정 값이 조금 더 높게 나오는 경향이 있음이 알려져 있다면, 그 값에 해당하는 probability를 높게 잡으면 된다. 이렇게 잡은 distribution을 prior distribution사전분포라고 한다. 만약 $\theta$에 대한 아무런 정보를 알고 있지 않다면 uniform distribution으로 잡거나 계산의 편리성을 위하여 conjuagcy로 잡는 등의 몇 가지 방법이 있다. 이런 경우를 noninformative prior distribution을 잡는다고 표현한다. 사실 $\theta$에 대한 사전 정보를 얻는다는 것이 현실적으로 가능할 때가 많지 않기 때문에 상당히 많은 경우에서 noninformative prior distribution을 활용하곤 한다.
- 이제 data $X$를 수집한다. Data 성격에 맞게 알맞는 분석 model $\mathcal{P}$이 가정되었을 때, data는 특정 값으로 고정된 $\theta$에 대하여 $P_{\theta}$ 아래에서 추출된다. 그러므로 우리는 data distribution은 $p(x\vert \theta)$의 형태를 띠게 된다.
- Data를 통해 $\theta$에 대한 추가 정보를 얻게 되었으므로 $\theta$의 uncertainty에 대한 정보가 업데이트되어야 한다. 그리고 그 업데이트 된 $\theta$의 distribution은 당연히 data $x$가 전제되어 있으므로 $p(\theta\vert x)$를 얻는다. 이를 posterior distribution사후분포라고 한다. Posterior distribution은 다음의 Bayes’ theorem을 통해 얻을 수 있다.
어떤 estimator $\delta$가 주어졌을 때, Bayesian 시각에서의 risk가 어떻게 되는지 알아보자. $\theta$가 관련한 정보들을 종합하여 prior distribution $\Lambda$를 따른다고 가정하자. 기존에는 risk function이 $\theta$에 관한 함수였다. 하지만 이제는 $\theta$에도 어떠한 uncertainty가 부여된 상황이므로 $\theta$가 따르는 probability distribution을 weight가중치삼아 risk를 새로이 정의할 수 있게 된다. 그러므로,
\[R(\theta, \delta) = \int E_{\theta}L(\theta, \delta)\,d\Lambda(\theta)\]가 되고 우리는 이를 minimize하는 $\delta$를 Bayesian estimation베이지안 추정이라고 할 것이다.
Bayesian Models
Bayesian model의 구성은 사전 정보를 활용하여 $\theta$의 prior distribution을 잡는 것부터 시작한다. $\Lambda$를 prior distribution으로 두자. 즉,
\[\Theta\sim\Lambda\]그리고 우리는 data에 대한 model를 다음과 같이 둔다고 하자.
\[X\vert\Theta =\theta \sim P_{\theta}\]그러면 $g(\theta)$의 estimator $\delta$에 대해 우리는 loss function의 expectation이 risk임을 다음과 같이 표현할 수 있다. 지금까지는 $\theta$가 어떤 주어진 값이었기에 $P_{\theta}$ 하의 expectation을 $E_{\theta}$로 표기해왔지만, Bayesian model에서는 $\Theta$가 random variable이기 때문에 하나의 conditonal expectation으로 표현해준다.
\[E[L(\Theta, \delta(X))\vert \Theta = \theta] = \int L(\theta, \delta(x))\,dP_{\theta} = R(\theta, \delta)\]그러면 smoothing에 의하여 $\theta$에 따라 $\Lambda$에 입각하여 weight sum을 계산해줄 수 있다.
\[EL(\Theta, \delta) = EE[L(\Theta, \delta)\vert \Theta] = ER(\Theta, \delta) = \int R(\theta, \delta)\, d\Lambda(\theta)\]위의 수치를 minimize하여 얻어지는 estimator $\delta$를 Bayes라고 부른다. 다음 theorem에서는 이 Bayes estimator를 어떻게 편리하게 찾을 수 있는지를 보여준다. 하지만 $EL(\Theta, \delta)$를 minimize하려는 위의 접근 방식과는 조금 다르게, data $X$가 주어졌을 때의 loss의 expectation $E[L(\Theta, d)\vert X =x]$를 $d$에 대하여 minimize하려는 시도를 할 것이다. 이 expectation을 posterior risk라고 하는데, 위에서 posterior distribution을 설명했던 것과 같은 맥락으로 data $X$를 관측한 후 정보가 update 된 후의 $\Theta$의 distribution으로부터 expectation을 구해보는 것이다.
Theorem 16.1 Prior distribution $\Theta\sim \Lambda$와 data의 model $X\vert\Theta\sim P_{\theta}$가 주어졌다고 하자. 또한, 모든 $\theta\in\Omega$와 모든 $d$에 대하여 loss function $L(\theta, d)\ge 0$이라고 하자. 만약,
\[E[L(\Theta, d)\vert X =x]\]
- 어떤 $\delta_0$에 대하여 $EL(\Theta, \delta_0)\lt\infty$이고,
- a.e. $x$에 대해, $d$에 대하여 다음을 minimize하는 $\delta_{\Lambda}(x)$가 있다면,
$\delta_{\Lambda}$는 Bayes estimator이다.
Proof: $\delta$가 임의의 estimator라고 하자. 그러면 a.e. $x$에 대하여
\[\begin{align*} E[L(\Theta, \delta(X))\vert X = x] &= E[L(\Theta, \delta(x)) \vert X = x] \\ &\ge E[L(\Theta, \delta_{\Lambda}(x))\vert X = x] \\ &= E[L(\Theta, \delta_{\Lambda}X(X))\vert X = x] \end{align*}\]이므로
\[E[L(\Theta, \delta(X))\vert X] \ge E[L(\Theta, \delta_{\Lambda}(X))\vert X]\]이다. 양변에 expectation을 씌워 smoothing을 활용해주면,
\[EL(\Theta, \delta(X)) \ge EL(\Theta, \delta_{\Lambda}(X))\]가 됨에 따라 $\delta_{\Lambda}$는 Bayes임이 증명되었다.
따라서 우리는 Bayes estimator을 찾기 위해 먼저 prior distribution과 data distribution(지금까지 해왔던 것과 같은 맥락으로 이 녀석도 likelihood라고 부른다)를 기반으로 posterior distribution을 찾은 후, Bayes estimator를 도출하면 된다.
이제 몇 가지 예를 살펴보도록 하자.
Example 16.2 Loss function으로 weighted squared error loss를 잡아보자. 지금까지는 그냥 squared error loss를 많이 활용했는데, 이번에는 $\theta$에 대한 weight이 있는 형태를 다루어보고자 한다. 이는 다음과 같이 표현할 수 있다.
\[L(\theta, d) = w(\theta)(d - g(\theta))^2\]Bayes estimator $\delta_{\Lambda}$를 찾기 위해서는 Theorem 16.1에 의하여 다음을 $d$에 대하여 minimize시켜야 한다.
\[\begin{align*} E[w(\Theta)(d - g(\Theta))^2\vert X = x] &= d^2 E[w(\Theta)\vert X = x] \\ &-2dE[w(\Theta)g(\Theta)\vert X =x] \\ &+E[w(\Theta)g^2(\Theta)\vert X = x] \end{align*}\]정리하고보니 위의 식은 $d$에 대한 이차식이다. 이를 minimize하는 $d$는 다음과 같이 찾을 수 있다.
\[\delta_{\Lambda}(x) = \frac{E[w(\Theta)g(\Theta \vert X = x)]}{E[w(\Theta)\vert X = x]}\]만약 weight이 모두 동등하게 1로 주어졌다면, 혹은 다른 말로 loss function으로 그냥 squared error loss를 활용했다면 우리는 다음을 얻는다.
\[\delta_{\Lambda}(x) = E[g(\Theta)\vert X =x]\]이는 역시 posterior distribution으로부터 도출 가능한 수치로써 $g(\Theta)$의 posterior mean사후 기댓값이라고 부른다.
조금 더 직관적으로, 만약 model $\mathcal{P}$가 dominated family라서 $P_{\theta}$가 density $p_{\theta}$를 가지고, 또 만약 prior distribution $\Lambda$가 absolute continuous하여 density $\lambda$를 가진다고 하면, $(X, \Theta)$의 joint density는 각각이 absolute continuous한 measure의 product에 대하여
\[p_{\theta}(x)\lambda(\theta)\]이며, $X$의 marginal density는
\[q(x) = \int p_{\theta}(x)\lambda(\theta)\,d\theta\]이다. 그러므로 posterior density는
\[\lambda(\theta\vert x) = \frac{p_{\theta}(x)\lambda(\theta)}{q(x)}\]이다. 따라서 Bayes estimator는 다음과 같이 구할 수 있으며, 주로 $q(x)$는 항상 같이 딸려오기 때문에 지워진다. 보통 Bayesian inference에서는 그러므로 위의 posterior density에서 분자의 값만을 신경 쓸 때가 많다.
\[\delta_{\Lambda}(x) = \frac{\int w(\theta)g(\theta)\cdot p_{\theta}(x)\lambda(\theta)\, d\theta}{\int w(\theta)p_{\theta}(x)\lambda(\theta)\,d\theta}\]
이제 Bayesian model에서 가장 기본적인 model인 binomial model를 살펴보도록 하자. 또, 이를 통해 frequentist가 제안한 unbiased estimator 중에서도 가장 performance가 좋은 UMVUE와 Bayesian이 제안한 Bayes estimator를 함께 비교해보자.
Example 16.3 만약 model $P_{\theta}$가 $n$번의 시행과 성공 probability $\theta$로 구성되는 binomial distribution이고, $\Theta$에 관한 아무런 사전 정보가 없는 경우 beta distribution을 prior distribution으로 많이 놓는다. Beta distribution으로 놓는 것이 바로 prior distribution을 conjugacy로 두는 대표적 예다. 앞서 conjugacy로 prior distribution을 설정하게 되면 계산을 편리하게 해준다는 점을 언급했는데, conjugacy가 model distribution과 만나서 posterior distribution을 구할 때 prior distribution과 똑같은 형태의 distribution을 준다는 면에서 그렇다. 즉, 여기서도 prior distribution을 Beta distribution으로 두게 되면 binomial model과 만나 posterior distribution도 parameter만 다른 Beta distribution이 된다. Prior distribution $\Lambda$를 $\text{Beta}(\alpha, \beta)$로 두자. 그러면 prior density는
\[\lambda(\theta) = \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}\theta^{\alpha-1}(1-\theta)^{\beta-1}, \quad\theta\in(0, 1)\]이다. Prior distribution에 의하면 $\Theta$는 prior mean을 다음과 같이 갖는다.
\[E\Theta = \frac{\alpha}{\alpha+\beta}\]이제 posterior distribution을 구해보자. 이는 다음을 활용할 것인데, 비례 상수는 $X$의 marginal density의 역수지만, 어차피 $x$에 관한 식으로써 주어지는 값이므로 따로 구하진 않을 것이다.
\[\begin{align*} \lambda(\theta\vert x) &\propto \lambda(\theta)p(x\vert\theta) &\propto \theta^{\alpha-1}(1-\theta)^{\beta -1} \cdot \theta^x (1-\theta)^{n-x} \\ &= \theta^{x+\alpha-1}(1-\theta)^{n-x+\beta-1}, \quad \theta\in (0, 1) \end{align*}\]정확한 density를 구하려면 단순 비례 관계에 놓인 식뿐만 아니라 계수까지도 모두 구해야 하겠지만, distribution의 형태를 알아보기 위해서는 계수까진 구할 필요는 없다. 위의 과정에서도 우리는 결국 posterior distribution이 다시 beta distribution을 따름을 알 수 있으며, 더 구체적으로는
\[\Theta\vert X =x \sim \text{Beta}(x+\alpha, n-x+\beta)\]가 된다. Parameter가 변화한 모습을 보면, $\alpha$ 자리는 prior distribution의 $\alpha$에서 시작하여 data 상에서의 성공 횟수 $x$만큼 더해지는 방식으로 update되었고, $\beta$ 자리는 역시 prior distribution의 $\beta$에서 시작하여 data상에서의 실패 횟수 $n-x$만큼 더해지는 방식으로 updata되었음을 확인할 수 있다.
Squared error loss를 가정하면, $\theta$에 대한 Bayes estimator는 그저 posterior mean임을 Example 16.2에서 밝힌 바 있다. 그러므로
\[\delta_{Lambda}(X) = E[\Theta\vert X] = \frac{X+\alpha}{n+\alpha+\beta}\]이를 조금만 풀어서 다시 살펴보면
\[\delta_{\Gamma}(X) = \left(\frac{n}{n+\alpha+\beta}\right)\frac{X}{n}+\left(1-\frac{n}{n+\alpha+\beta}\right)\frac{\alpha}{\alpha+\beta}\]가 된다. 이것이 가지는 의미는 Bayes estimator는 data의 UMVUE인 $X/n$과 prior mean $E\Theta = \alpha/(\alpha+\beta)$의 weighted mean이라는 것이다. 즉, 원래의 prior mean에서 data가 어느 정도 $\theta$의 정보에 영향을 주었다고 생각할 수 있고, $n$이 무한히 커져 data의 영향도가 커지면 UMVUE의 weight가 1로 converge하므로 posterior mean을 구성할 때에 prior mean의 영향은 미미하고 data의 영향이 절대적으로 커짐을 알 수 있다. 또, Bayes estimator는 항상 unbiased하게 주진 않음을 시사하기도 한다.
마지막으로 negative binomial model에 대해 살펴볼 것이다. 사실 이 model은 sequential experiment를 소개할 때, 기존의 binomial model의 한계점과 그로 비롯되는 sequential experiment의 필요성을 설명하고자 예를 들었던 model이다(Mathematical Statistics - Curved Exponential Family편의 Example 12.3을 참조하라). 이를 Bayesian으로 다시 접근 후에 Bayes estimator를 도출하고, 기존에 구했던 UMVUE와 risk를 비교해보자.
Example 16.4 성공 probability가 $\theta$인 Bernoulli 시행의 sequence를 고려하자. 그리고 data $X$는 두 번째 성공 전 실패한 횟수로 수집된다. 그러면 model $\mathcal{P}$의 density는 counting measure에 대하여 다음과 같이 표현된다.
\[p(x\vert \theta) = (x+1)\theta^2(1-\theta)^x\]우리는 Example 12.3에서 $g(\Theta) = 1/\Theta$를 estimate하기로 했었다. $\Theta$에 대한 별다른 사전 정보가 없기에 여기에서는 그냥 uniform distribution을 prior distribution으로 두고자 한다. 즉,
\[\Theta \sim \mathcal{U}(0, 1)\]그러면 posterior distribution은
\[\lambda(\theta\vert x)\propto \lambda(\theta)p(x\vert\theta)\propto \theta^2(1-\theta)^x\]가 도출된다. 이로써 우리는
\[\Theta\vert X =x \sim \text{beta}(3, x+1)\]임을 알 수 있다. Squared error loss 아래에서 Bayes estimator인 $g(\Theta)$의 posterior mean은
\[\begin{align*} \delta_0(x) &= E\left[\frac{1}{\Theta}\bigg\vert X = x\right]\\ &= \frac{\Gamma(x+4)}{\Gamma(3)\Gamma(x+1)}\int_0^1\frac{1}{\theta}\cdot \theta^2(1-\theta)^x\,d\theta \\ &= \frac{\Gamma(x+4)\Gamma(2)\Gamma(x+1)}{\Gamma(3)\Gamma(x+1)\Gamma(x+3)} \\ &= \frac{x+3}{2} \end{align*}\]이다. Example 12.3에서는 UMVUE estimator
\[\delta_1(x) = \frac{x+2}{2}\]를 도출했었다. 이때 $m = 2$인 경우임을 참고하라. 꽤나 신기한 결과가 나왔는데, Bayes가 UMVUE보다 항상 $1/2$ 크게 예측값을 준다는 점이다.
\[\delta_0(X) = \delta_1(X) + \frac{1}{2}\]고정된 $\theta$에 대하여 risk를 서로 비교해보자. 둘의 차이가 constant이기 때문에 variance는 둘 다 똑같을 것이다. 하지만 $\delta_1$은 bias가 0인 반면에 $\delta_0$는 bias가 $1/2$이므로 $R(\theta, \delta_0)$가 $R(\theta, \delta_1)$보다 항상 $1/4$만큼 크다.
이렇게 어떤 estimator에 대하여 risk function이 더 좋은(즉, 모든 $\theta$에 대하여 risk가 작은) 다른 estimator가 있다면, 그 estimator는 inadmissible하다고 표현한다. 이 경우, $\delta_0$은 $\delta_0$의 risk function보다 더 좋은 risk function을 가진 $\delta_1$이 있기에 inadmissible하다. 보통은 Bayes estimator가 inadmissible이 되는 경우는 거의 없는데, risk function이 좋으면 보통 이를 적분한 것도 값이 작게 도출되기 때문이다. 하지만, 이 경우에서는 Bayes estimator가 inadmissible한 이유는 Theorem 16.1의 첫 번째 condition을 만족하지 않기 때문이다. 첫 번째 조건을 만족하지 않는 경우는 상당히 조심스러운 것이, 그 어느 estimator도 $\int R(\theta, \delta)\,d\Lambda(\theta)$를 minimize할 수 있다는 면에서 그러하다.
이번 내용을 통해 estimator를 비교하는 또 하나의 방법론을 알 수 있었을 것이다. 다음 편에서는 일반적으로 estimator가 더 좋다는 것을 어떻게 수학적으로 표현할 수 있을지 알아보고, 왜 risk function을 활용하여 estimator의 performance를 비교하는 것이 정당화될 수 있었는지 더욱 원론적으로 알아보도록 한다.