配適 AR(2) 模型
在這個練習中,我們用 AR(2) 模型 $$X_t = 1.5 X_{t-1} - .75 X_{t-2} + W_t$$ 產生了資料,使用的指令是 x <- arima.sim(model = list(order = c(2, 0, 0), ar = c(1.5, -.75)), n = 200)。請先檢視模擬資料,以及樣本 ACF 與 PACF 的組合圖,以判斷模型階數。接著配適模型,並將估計參數與真實參數進行比較。
本練習屬於課程
R 中的 ARIMA 模型
練習說明
- 已預先載入 astsa 套件。
x含有 200 筆 AR(2) 觀測值。 - 使用
plot()繪製x中產生的資料。 - 使用
astsa套件的acf2()畫出樣本 ACF 與 PACF 的組合圖。 - 使用
sarima()對x的先前產生資料配適 AR(2) 模型。檢視 t 表,並將估計值與真實值比較。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# astsa is preloaded
# Plot x
# Plot the sample P/ACF of x
# Fit an AR(2) to the data and examine the t-table