การประมาณค่าและพยากรณ์โมเดล MA

การวิเคราะห์อนุกรมเวลาใน R

David S. Matteson

Associate Professor at Cornell University

  • อัตราเงินเฟ้อของสหรัฐฯ รายเดือน (หน่วย: ร้อยละ อัตรารายปี)
  • ข้อมูลรายเดือนตั้งแต่ปี 1950 ถึง 1990
data(Mishkin, package = "Ecdat")
inflation <- as.ts(Mishkin[, 1])

inflation_changes <- diff(inflation)
ts.plot(inflation) ; ts.plot(inflation_changes)

การวิเคราะห์อนุกรมเวลาใน R

กระบวนการ MA: การเปลี่ยนแปลงของอัตราเงินเฟ้อ - II

  • Inflation_changes: การเปลี่ยนแปลงของอัตราเงินเฟ้อรายเดือนของสหรัฐฯ
  • พล็อตอนุกรมและค่า ACF ของตัวอย่าง:
ts.plot(inflation_changes)
acf(inflation_changes, lag.max = 24)

การวิเคราะห์อนุกรมเวลาใน R

$Today = Mean + Noise + Slope * (Yesterday's Noise)$ $$Y_t = \mu + \epsilon_t + \theta\epsilon_{t-1}$$ $$\epsilon_t ~ WhiteNoise(0, \sigma_{\epsilon}^2)$$

MA_inflation_changes <- arima(inflation_changes, 
                              order = c(0, 0, 1))

print(MA_inflation_changes)
Coefficients:
         ma1  intercept
      -0.7932    0.0010
s.e.   0.0355    0.0281
sigma^2 estimated as 8.882

ma1 = $\hat{\theta}$, intercept = $\hat{\mu}$, sigma^2 = $\hat{\sigma^2_{\epsilon}}$

การวิเคราะห์อนุกรมเวลาใน R

กระบวนการ MA: ค่าที่พอดี - I

  • ค่าที่พอดีจากโมเดล MA:

$$\hat{Y_t} = \hat{\mu} +\hat{\theta}\hat{\epsilon_{t-1}}$$

  • ค่าคงเหลือ =

$$\hat{\epsilon_t} = Y_t - \hat{Y_t}$$

การวิเคราะห์อนุกรมเวลาใน R
ts.plot(inflation_changes)
MA_inflation_changes_fitted <- 
    inflation_changes - residuals(MA_inflation_changes)

points(MA_inflation_changes_fitted, type = "l", col = "red", lty = 2)

การวิเคราะห์อนุกรมเวลาใน R

การพยากรณ์

  • การพยากรณ์ล่วงหน้า 1 ช่วง:
predict(MA_inflation_changes)$pred
Jan
1991 4.831632
predict(MA_inflation_changes)$se
Jan
1991 2.980203
การวิเคราะห์อนุกรมเวลาใน R

การพยากรณ์ (ต่อ)

  • การพยากรณ์ล่วงหน้า h ช่วง:
    predict(MA_inflation_changes, n.ahead = 6)$pred
    
           Jan       Feb       Mar       Apr       May       Jun
1991  4.831632  0.001049  0.001049  0.001049  0.001049  0.001049
predict(MA_inflation_changes, n.ahead = 6)$se
           Jan       Feb       Mar       Apr       May       Jun
1991  2.980203  3.803826  3.803826  3.803826  3.803826  3.803826
การวิเคราะห์อนุกรมเวลาใน R

มาฝึกกันเถอะ!

การวิเคราะห์อนุกรมเวลาใน R

Preparing Video For Download...