R 如何模擬產生 ARIMA 數列

下面是 R 中 arima.sim 函數中,建構 ARIMA 序列主要的幾行碼:


1. 先產生 innovation 序列

2. 產生 MA output  序列:  用 filter 函數將 innovation 序列作為 input 序列,令 x-t = inn-t,產生 MA output  序列 { y-t }:


3. 產生 AR output  序列: 用 filter 函數,將 {y-t} 序列作為 input 序列,令 x-t = y-t,產生 AR output  序列 { y-t }:


上式中的 x-t 即表示 MA 序列(如果是要產生 ARIMA 或 ARMA),將它作為 input 序列,用以生成 AR 序列。方式如下:


4.  產生 Integration 序列: 用 diffinv 函數,integration 回差前序列。

以上,由 innovation 開始,最終產生一 ARIMA(p,d,q) 序列。


留言

這個網誌中的熱門文章

標準差與 Wald 統計量

可能性比檢定(Likelihood ratio test)

Wold Decomposition Theorem