예측 (Prediction)
회귀식을 이용해서 모델을 만들고, 모델이 유의한지 검정했다면 모델 자체에 대한 검증은 끝난 것이다. 이제는 모델을 이용해 예측을 하고, 이 예측에 대한 검증을 해야 한다.
예측은 적합된 과거 데이터가 아닌 새로운 데이터(new observations)에 대한 예측이다. 예측하고자 하는 설명변수 데이터를 다음과 같이 가정하자.
$$ \mathbf{x}_0 = \begin{bmatrix} 1 \\ x_{01} \\ x_{02} \\ \vdots \\ x_{0k} \end{bmatrix} $$
그리고 이에 대한 예측값 $ y(\mathbf{x}_0) $ 에 대한 점 추정치와 그에 대한 분산은 다음과 같다.
$$ \hat{y}(\mathbf{x}_0) = \hat{\mu}_{y \mid \mathbf{x}_0} = \mathbf{x}^\prime_0 \hat{\boldsymbol{\beta}} $$
$$ \mathrm{Var}[\hat{y}(\mathbf{x}_0)] = \sigma^2 \mathbf{x}^\prime_0 ( \mathbf{X}^\prime \mathbf{X})^{-1}) \mathbf{x}_0 $$
이제 예측 오차(prediction error 혹은 forecast error)를 계산하자. 예측 오차는 다음과 같다.
$$ y(\mathbf{x}_0) - \hat{y}(\mathbf{x}_0) $$
그렇다면 예측 오차의 분산은 다음과 같다.
$$ \mathrm{Var}[y(\mathbf{x}_0) - \hat{y}(\mathbf{x}_0)] = \sigma^2 \left[ 1 + \mathbf{x}^\prime_0 ( \mathbf{X}^\prime \mathbf{X})^{-1}) \mathbf{x}_0 \right] $$
$ y(\mathbf{x}_0) $ 와 $ \hat{y}(\mathbf{x}_0) $ 는 독립이기에 다음과 같다.
$ \mathrm{Var}[y(\mathbf{x}_0) - \hat{y}(\mathbf{x}_0)] = \mathrm{Var}[y(\mathbf{x}_0)] - \mathrm{Var}[\hat{y}(\mathbf{x}_0)] $
$ \mathrm{Var}[y(\mathbf{x}_0)] = \sigma^2 $ 이므로 다음이 성립한다.
$ \mathrm{Var}[y(\mathbf{x}_0)] - \mathrm{Var}[\hat{y}(\mathbf{x}_0)] = \sigma^2 \left[ 1 + \mathbf{x}^\prime_0 ( \mathbf{X}^\prime \mathbf{X})^{-1}) \mathbf{x}_0 \right] $
이때 $ \hat{\sigma}^2 $ 은 다음과 같다는 것을 기억하자.
$$ \hat{\sigma}^2 = \frac{SSE}{n-p} = (\mathbf{y} - \mathbf{X} \hat{\boldsymbol{\beta}})^\prime (\mathbf{y} - \mathbf{X} \hat{\boldsymbol{\beta}}) $$
이제 통계량 $ t $ 를 만들자.
$$ t = \frac{y(\mathbf{x}_0) - \hat{y}(\mathbf{x}_0)}{\sqrt{\sigma^2 \left[ 1 + \mathbf{x}^\prime_0 ( \mathbf{X}^\prime \mathbf{X})^{-1}) \mathbf{x}_0 \right]}} $$
이때 오차분산 $\sigma^2 $ 대신 추정치 $ \hat{\sigma}^2 $ 을 사용할 수 있다.
위 $ t $ 는 분자가 정규분포를 따르고, 분모가 분자의 표준편차이므로 $ t $-분포를 따른다. 따라서 다음과 같은 $ y (\mathbf{x}_0) $ 에 대한 신뢰구간을 만들 수 있다. 여기서는 이를 예측구간(PI, prediction interval - 참고링크)이라 한다.
$$ \hat{y}(\mathbf{x}_0) \pm t_{\alpha / 2}(n-p) \sqrt{\sigma^2 \left[ 1 + \mathbf{x}^\prime_0 ( \mathbf{X}^\prime \mathbf{X})^{-1}) \mathbf{x}_0 \right]} $$
오차분산 $\sigma^2 $ 대신 추정치 $ \hat{\sigma}^2 $ 을 사용하여 다음과 같이 나타낼 수 있다.
$$ \hat{y}(\mathbf{x}_0) \pm t_{\alpha / 2}(n-p) \sqrt{\hat{\sigma}^2 \left[ 1 + \mathbf{x}^\prime_0 ( \mathbf{X}^\prime \mathbf{X})^{-1}) \mathbf{x}_0 \right]} $$
'Statistics > Time Series Analysis' 카테고리의 다른 글
[Time Series Analysis] 더빈-왓슨 검정(Durbin-Watson test) (0) | 2025.04.07 |
---|---|
[Time Series Analysis] 선형회귀모델 적합성 확인(adequacy checking) (0) | 2025.04.07 |
[Time Series Analysis] 선형회귀모델 가설 검정(hypothesis test) (0) | 2025.04.07 |
[Time Series Analysis] 선형회귀모델(linear regression models) (0) | 2025.03.26 |
[Time Series Analysis] 예측 모델(forecasting model) 모니터링(monitoring) (0) | 2025.03.26 |