본문 바로가기
Mathematics/통계학

[통계학] 5.2-(2) 스튜던트 t 분포 Student's t-distribution

by 피그티 2021. 8. 16.

5.2-(1) Example: 정규 분포에서의 샘플 평균, 샘플 분산 Sample mean and Sample variance of Random sample from Normal Distribution에서 정규 분포에서 샘플링을 한 경우, 샘플 평균과 샘플 분산은 다음과 같은 분포를 따른다는 것을 살펴보았다.

\[ \begin{array}{ccc} \overline{X} & \sim & \mathcal{N}(\mu, \frac{\sigma^2}{n}) \\ \\ (n-1)\frac{S^2}{\sigma^2} & \sim & \chi _{n-1} ^2 \end{array} \]

특히 하나의 random sample \(X_i \sim \mathcal{N}(\mu, \sigma^2)\) 와 샘플 평균을 비교해보자. 우리가 정규 분포를 따르는 모분포에서 샘플을 하나 뽑는 것과 여러 샘플을 뽑아 하나의 샘플 평균을 얻는 것은 평균적으로 \(\mu\) 값이 얻어질 것으로 기대된다는 점은 같다. 그러나 샘플 하나를 뽑는 것은 분산이 \(\sigma^2\) 인 반면, 하나의 샘플 평균을 얻는 것은 분산이 \(\frac{\sigma^2}{n}\) 이다. 분산의 정의가 평균으로부터 벗어난 정도를 표현하는 것이라는 점으로부터, 하나의 샘플 평균이 \(\mu\) 에서 벗어나는 정도가 한 개의 샘플 자체가 평균 \(\mu\)에서 벗어나는 정도보다 훨씬 작다는 것을 말해준다. 게다가 샘플의 수가 늘어나면 늘어날 수록, 샘플 평균이 \(\mu\) 에서 벗어나는 정도는 줄어든다는 것을 말해준다.

 

따라서, 우리가 모분포의 매개변수 \(\mu\) 값을 알지 못하는 경우에, 이를 추정하기 위하여, 한 개의 샘플 자체를 사용하는 것보다 여러개의 샘플을 추출하여 샘플 평균을 사용하는 것이 더 정확한 예측 방법이라고 할 것이다. 또한 샘플 개수를 적절하게 선택함으로써 샘플 평균이 \(\mu\) 로부터 벗어나는 정도를 어느 한도로 컨트롤하면서 \(\mu\) 값을 예측할 수 있을 것이다. 이러한 논리가 통계학의 목표, "에러를 컨트롤하면서 알지 못하는 값 추정"을 가능하게 해준다.

 

또한 3.7-① 표준 정규 분포 Standard Normal Distribution에서 사용한 방법을 이용하여 다음과 같이 standard normal distribution을 따르는 random variable을 만들 수 있다.

\[ Z = \frac{\overline{X} - \mu}{\sigma / \sqrt{n}} \sim \mathcal{N}(0,1) \]

즉, \(Z\) 가 \(\mathcal{N}(0,1)\)이라는 정해진 분포를 따르게 되므로 \(Z\) 의 realization[각주:1]을 측정할 수 있다면, standard normal distribution의 확률과 값들을 이용하여 에러를 컨트롤할 수 있게 된다.

 

 

#Student's t-distribution

그러나 일반적으로 통계 예측을 할 때 평균 \(\mu\) 의 값을 정확히 모르듯이, 분산 \(\sigma^2\) 의 값을 정확히 알고 나서 샘플링을 한다는 것은 현실적이지 않다. \(\sigma^2\) 대신 sample variance를 사용하여 \(\frac{\overline{X} - \mu}{\sqrt{S^2 / n }}\) 의 분포는 어떨까? 식을 조금 변형하면,

\[ \frac{\overline{X} - \mu}{\sqrt{S^2 / n}} = \frac{\overline{X} - \mu}{ \sigma/\sqrt{n}} \sqrt{\frac{1}{n-1}\frac{\sigma^2}{S^2}} \sqrt{n-1} \]

이 때, \(\frac{\overline{X}-\mu}{\sigma/\sqrt{n}}\sim Z\) 이고, \((n-1)\frac{S^2}{\sigma^2} \sim \chi _{n-1} ^2\) 이므로

\[ \frac{\overline{X} - \mu}{\sqrt{S^2 / n}} \sim Z\sqrt{\frac{n-1}{\chi _{n-1} ^2}} \]

의 분포를 따른다. 이 분포를 Student's t-distribution이라고 부른다.

 

DEFINITION          Student's t-distribution

다음 pdf를 따르는 확률 분포를 degree of freedom이 \(\nu\) 인 Student's t-distribution이라고 부른다.
\[ f(t) = \frac{\Gamma \left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)} \frac{1}{\sqrt{\nu\pi}} \left(1+\frac{t^2}{\nu} \right) ^{-\frac{\nu+1}{2}} \]
Random variable \(X\) 가 degree of freedom이 \(\nu\) 인 Student's t-distribution을 따르는 경우 다음과 같이 표현한다.
\[ X \sim t_\nu \]

 

Student's t-distribution의 pdf는 다음과 같은 그래프를 가진다.

 

Student t pdf

Skbkekas, CC BY 3.0, via Wikimedia Commons

 

그래프에서 볼 수 있듯이 0을 중심으로 좌우가 같다. 따라서 평균값이 존재한다면 0이 될 것이라는 것을 예상할 수 있을 것이다.[각주:2] 또한 degree of freedom \(\nu\) 가 증가할 수록 0 근처에서의 확률이 커지고, 0에서 떨어진 값에서의 확률은 감소한다는 것을 알 수 있다.[각주:3]

 

 

#Basic Properties

1. Mean of Student's t-distribution

\[ E[X] = 0 \text{ if } \nu > 1 \]

 

(증명)

\[ \begin{align*} E[X] &= \int _{-\infty} ^{\infty} t f(t) ~dt \\ \\ &= \frac{1}{(\nu\pi)^{1/2}} \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)} \int _{-\infty} ^\infty \frac{t}{(1+t^2/p)^{(p+1)/2}}~dt \end{align*} \]

이제 \(z=1+\frac{t^2}{\nu}\) 로 치환하여 적분하면,

\[ \begin{align*} E[X] &= \frac{1}{(\nu\pi)^{1/2}} \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)}\frac{\nu}{2}\frac{1}{z^{(\nu+1)/2}}~dz \\ \\ &= \left. \frac{1}{(\nu\pi)^{1/2}} \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)}\frac{\nu}{2} \left(-\frac{2}{\nu-1}\right) z^{-\frac{\nu-1}{2}} \right| _0 ^\infty \\ \\ &= 0 \end{align*} \]

단, 마지막 줄은 \(\nu > 1\) 일 때만 성립함을 주의하자. 따라서

\[ E[X] = 0 \text{ if }\nu > 1 \]

(증명 끝)

 

2. Variance of Student's t-distribution

\[ \text{Var}(X) = \frac{\nu}{\nu-2} \text{ if } \nu > 2\]

 

(증명)

평균이 0이므로, \(\text{Var}(X) = E\left[X^2 \right]\) 가 된다.

\[ \begin{align*} E\left[ X^2 \right] &= \int _{-\infty} ^{\infty} t^2 f(t) ~dt \\ \\ &= \frac{1}{(\nu\pi)^{1/2}} \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)} \int _{-\infty} ^\infty \frac{t^2}{(1+t^2/\nu)^{(\nu+1)/2}}~dt \end{align*} \]

부분 적분을 이용하면,

\[ \begin{align*} E\left[ X^2 \right] &= \left. \frac{1}{(\nu\pi)^{1/2}} \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)} \frac{\nu}{2} \left(-\frac{2}{\nu-1} \right) \left(1+\frac{t^2}{\nu}\right)^{\frac{\nu-1}{2}} t \right| _{-\infty} ^\infty \\ \\ &~~~~~~~~ \frac{1}{(\nu\pi)^{1/2}} \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)} \frac{\nu}{2} \left(-\frac{2}{\nu-1} \right) \int _{-\infty} ^\infty \left(1+\frac{t^2}{\nu} \right)^{-\frac{\nu-1}{2}} ~dt \end{align*} \]

첫번째 항은 0이고, 이제 두번째 항을 계산하기 위하여, \(z=\sqrt{\frac{\nu-2}{\nu}t\) 로 치환하면, 적분 부분은

\[ \sqrt{\frac{\nu}{\nu-2}} \int _{-\infty} ^\infty \left(1+\frac{z^2}{\nu-2}\right) ^{-\frac{\nu-1}{2}} ~dz \]

이므로 degree of freedom이 \(\nu-2\) 인 Student's distribution pdf의 적분과 같으므로, 적분값은

\[ \frac{\Gamma\left(\frac{\nu-2}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)}\sqrt{(\nu -2)\pi} \]

가 된다. 단, \(\nu > 2\) 일 때만 성립함을 주의하자. 이제 gamma function의 성질을 이용하면

\[ \text{Var}(X) = \frac{\nu}{\nu-2} \text{ if }\nu > 2\]

(증명 끝)

 

 

#Related Distributions

1. Distribution of Sample mean from Normal distribution

이제 위에서 논의한 내용을 증명해보자.

 

THEOREM

Random variable \(U\), \(V\) 가 각각 standard normal distribution, degree of freedom이 \(\nu\) 인 chi-squared distribution을 따른다고 하자. 또한 \(U\) 와 \(V\) 는 서로 independent하다고 하자. 그러면
\[ \frac{U}{\sqrt{V / \nu}} \sim t_\nu \]

 

(증명)

\(U\)[각주:4]와 \(V\)[각주:5]의 pdf

\[ \begin{align*} f_U(u) &= \frac{1}{\sqrt{2\pi}} e^{\frac{1}{2}u^2} \\ \\ f_V(v) &= \frac{1}{2^{\nu/2}\Gamma\left(\frac{\nu}{2}\right)} v^{\frac{\nu}{2}-1} e^{-\frac{v}{2}} \end{align*} \]

로부터 \(U\) 와 \(V\) 는 서로 independent이므로, joint pdf는 다음과 같다.

\[ f_{U,V}(u,v) = \frac{1}{\sqrt{2\pi}}\frac{1}{2^{\nu/2}\Gamma\left(\frac{\nu}{2}\right)} e^{\frac{1}{2}u^2} v^{\frac{\nu}{2}-1} e^{-\frac{v}{2}} \]

이제 transform[각주:6]

\[ t = \frac{u}{\sqrt{v/\nu}} ~~~~,~~~~ w=v \]

의 joint pdf를 구하고, 이를 이용해 \(t\) 의 marginal pdf를 구해보자. 이 transform의 Inverse Jacobian determinant는 \((w/\nu)^{1/2}\) 이므로

\[ \begin{align*} f_{T,W}(t,w) &= f_{U,V}\left(t\left(\frac{w}{p} \right)^{1/2}, w \right) \left(\frac{w}{p}\right)^{1/2} \\ &= \frac{1}{(2\pi\nu)^{1/2}} \frac{1}{2^{\nu/2} \Gamma\left(\frac{\nu}{2}\right)} e^{-\frac{1}{2}\left(1+\frac{t^2}{\nu}\right)w} w^{\frac{nu+1}{2}-1} \end{align*} \]

따라서 \(t\) 의 marginal pdf는

\[ f(t) = \frac{1}{(2\pi\nu)^{1/2}} \frac{1}{\Gamma\left(\frac{\nu}{2}\right) 2^{\nu/2}} \int _0 ^\infty e^{-\frac{1}{2}\left(1+\frac{t^2}{\nu}\right)w} w^{\frac{\nu+1}{2}-1} ~ dw \]

이 때, gamma function의 정의[각주:7]와 같으므로

\[ f(t) = \frac{1}{(2\pi\nu)^{1/2}} \frac{1}{2^{\nu/2}\Gamma\left(\frac{\nu}{2}\right)}\Gamma\left( \frac{\nu+1}{2} \right) \left[ \frac{2}{1+t^2/\nu} \right] ^{(\nu+1)/2} \]

(증명 끝)

 

2. F-distribution

Random variable \(X \sim t_\nu\) 일 때, \(X^2\) 은 F-distribution을 따른다.[각주:8]

\[ X^2 \sim F(1,\nu) \]

이를 확인하기 위해서 다음과 같은 집합을 정의하자.

\[ \begin{align*} A_0 &= \{ x ~:~ x=0 \} \\ \\ A_1 &= \{ x ~:~ x>0 \} \\ \\ A_2 &= \{ x ~:~ x<0\} \end{align*} \]

그러면, \(A_0\) 는 measure-zero이고, transform \(Z=X^2\) 은 \(A_1\), \(A_2\) 에서 각각 1대1 대응이므로,

\[ \begin{align*} f_Z(z) &= f_X \left(\sqrt{z}\right) \frac{1}{2\sqrt{z}} + f_X\left(-\sqrt{z}\right) \frac{1}{2\sqrt{z}} \\ \\ &= \frac{1}{B\left(\frac{1}{2},\frac{\nu}{2}\right)} \left( \frac{1}{\nu} \right)^{\frac{1}{2}} z^{\left(\frac{1}{2}-1\right)} \left(1+\frac{1}{\nu}z\right) ^{-\frac{1+p}{2}} \end{align*} \]

즉, \(F(1,\nu)\) 의 pdf가 된다.

 

3. Asymptotically Standard Normal Distribution

Degree of freedom \(\nu\) 가 커질 수록 Student's t-distribution은 점점 normal distribution으로 수렴하게 된다. 이를 살펴보기 위해 Stirling's approximation[각주:9]

\[ \lim _{\nu \to \infty} \Gamma(\nu) = \sqrt{\frac{2\pi}{\nu}} \left(\frac{\nu}{e}\right)^\nu \]

를 이용하면,

\[ \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)} \to \sqrt{\frac{\nu}{2}} \left(\frac{\nu+1}{\nu}\right)^{\nu/2} e^{-1/2} \]

이므로

\[ f(t) \to \frac{1}{(2\pi)^{1/2}}\left(1+\frac{1}{\nu}\right)^{\nu/2}e^{-1/2}\left(1+\frac{t^2}{\nu}\right)^{-\frac{\nu+1}{2}} \]

이 때, exponential의 정의

\[ \begin{align*} \lim _{\nu \to \infty} \left(1+\frac{1}{\nu}\right)^{\nu/2} &= e^{1/2} \\ \\ \lim _{\nu \to \infty} \left(1+\frac{x^2}{\nu}\right)^{-(p+1)/2} &= e^{-x^2 /2} \end{align*} \]

를 이용하면,

\[ \lim _{\nu \to \infty} f(t) = \frac{1}{\sqrt{2\pi}} e^{-x^2/2} \]

 

 

  1. random sample의 realization은 5.1 무작위 추출 Random Samples 참고 [본문으로]
  2. 0을 중심으로 좌우가 같은 모양이라고 하더라도 평균값이 존재하지 않을 수 있다. 이에 대한 자세한 내용은 2.2 기대값 Expected Values 참고 [본문으로]
  3. normal distribution의 그래프와 한번 비교해보는 것도 좋을 것이다. 3.7 정규 분포 Normal Distribution 참고 [본문으로]
  4. standard normal distribution의 pdf에 대해서는 3.7-① 표준 정규 분포 Standard Normal Distribution 참고 [본문으로]
  5. chi-squared distribution의 pdf에 대해서는 ...chi-squared... 참고 [본문으로]
  6. 확률 분포의 변환에 대해서는 4.4 랜덤 변수의 변환 (2) Transformations of Random Variables (2) 참고 [본문으로]
  7. gamma function에 대해서는 ...gamma distribution... 참고 [본문으로]
  8. F-distribution에 대해서는 ...Snedecor's F-distribution... 참고 [본문으로]
  9. ...Stirling's approximation... 참고 [본문으로]