Worksheet 7: Simulating ARMA Models from White Noise
Transcription
Worksheet 7: Simulating ARMA Models from White Noise
Econ 3355 Forecasting Spring 2015 Worksheet 7: Simulating ARMA Models from White Noise This worksheet plays off of textbook Exercise 7.3 (p. 378) to simulate ARMA models from white noise data (random shocks.) I. Introduction • Question: Why can ARMA Models be generated from white noise? • Answer: In the deep mathematics of ARIMA models, every (stationary) ARMA model can be expressed as an “infinite sum” of random shocks from the “indefinite past”: Yt = c + ∞ X wi et−i = c + w0 et + w1 et−1 + w2 et−2 + w3 et−3 + w4 et−4 + . . . (1) i=0 where the weights wi are appropriately chosen to make the time series Yt unique (for example, to make Yt into an MA(3) or an ARMA(2,1) model.) • Equation (1) has an intuitive interpretation for economic and business time series: Every (current) market is the weighted sum of all past developments (random shocks) within the market! • Examples: 1. MA(3) Yt = c + et − θ1 et−1 − θ2 et−2 − θ3 et−3 =⇒ w0 = 1, w1 = −θ1 , w2 = −θ2 , w3 = −θ3 , wi = 0 for i ≥ 4 (influence of random shocks “cuts off” after 3 time periods) 2. AR(2) Yt = c + et + φ1 Yt−1 + φ2 Yt−2 = c + ∞ X wi et−i i=0 =⇒ For this model all weights wi are nonzero but the expressions for wi in terms of φ1 and φ2 are complicated and so are omitted from the worksheet. 1 II. Simulating AR(1) 1. Use Exercise 7.3 (a) — text page 378. (Set φ1 = 0.6) 2. Download the MINITAB worksheet (data file) WN. Open WN in Excel. (If Excel complains about file types may need to copy and paste all columns.) 3. Manually calculate the first few terms of Yt ∼ AR(1): Yt = c + et + φ1 Yt−1 = (0.6)Yt−1 + et (set constant c = 0 for simplicity.) (a) Y1 = (0.6)Y0 + e1 = (0.6)(0) + e1 = 0 + 0.01 = 0.01 (b) Y2 = (0.6)Y1 + e2 = (0.6)(0.01) + 1.38 = 0.006 + 1.38 = 1.386 (c) Y3 = (0.6)Y2 + e3 = (0.6)(1.386) + 0.53 = 0.8316 + 0.53 = 1.3616 4. Create an Excel formula which recursively calculates Yt : (a) In cell E3 type = (0.6)* E2 + A3 (and enter.) (You should see the value 0.01 .) (b) After setting this pattern select cell E3 and pull down from lower-right corner through Time Period 30. (c) If successful, Y1 , Y2 , Y3 should match hand calculations and end with Y30 = −0.42688. 5. Save the Excel file. Call it Simdata. 6. Analyze the data in MINITAB. (a) Open the Excel file Simdata in MINITAB. Immediately create a MINITAB project file, also called Simdata. (b) Make a multiple time plot of the two time series White Noise Data and Y together. Based on the plot is it difficult to tell which time series is purely random and which is not? 2 (c) Fit both ACF and PACF plots to White Noise Data. Are they as expected? (d) Fit both ACF and PACF plots to Y. We know from construction that Yt ∼ AR(1). Yet which two ARMA models are indicated as possible models from ACF and PACF diagnostics? (e) Fit both AR(1) and MA(1) models to Yt . Do these models appear adequate? ◦ Significant model terms? ( φ1 in AR(1) and θ1 in MA(1) ) ◦ White-noise residual ACF and PACF plots? ◦ Large P -values for chi-square (portmanteau) tests for white-noise residuals? 7. Analyze the data in JMP. (a) Open the Excel file Simdata in JMP. Open a time-series model for Yt with Time ID = Time Period. (b) Fit both AR(1) and MA(1) in JMP. (Use red triangle.) Examine residuals plots for each. Which model fits better, according to AIC? (c) Is the estimated parameter φb1 in AR(1) close to the known value φ1 = 0.6? (d) Examine 25-period forecasts for both AR(1) and MA(1). (Use Save columns from the model’s red triangle.) Are the eventual forecasts and forecast intervals from the two models similar? III. Simulating MA(1) 1. Use Exercise 7.3 (b) — text page 378. (Set θ1 = −0.6) 2. Return to the Simdata Excel file. 3. Manually calculate the first few terms of Zt ∼ MA(1): Zt = c + et − θ1 et−1 = et − (−0.6)et−1 = et + (0.6)et−1 (set constant c = 0 for simplicity.) (a) Z1 = e1 + (0.6)e0 = e1 + (0.6)(0) = 0.01 + 0 = 0.01 (b) Z2 = e2 + (0.6)e1 = 1.38 + (0.6)(0.01) = 1.38 + 0.006 = 1.386 3 (c) Z3 = e3 + (0.6)e2 = 0.53 + (0.6)(1.38) = 0.53 + 0.828 = 1.358 (d) Calculate Z4 NOW on your own! What’s your answer? Z4 = ? 4. Create an Excel formula to recursively calculate Zt : (a) In cell G3 type the value (b) In cell G4 type 0.01 A4 + (0.6)*A3 (and enter.) (and enter.) (You should see the value 1.386 .) (c) After setting this pattern select cell G4 and pull down from lower-right corner through Time Period 30. (d) If successful, Z1 , Z2 , Z3 , Z4 should match hand calculations and end with Z30 = 0.118. 5. Save the Excel file Simdata again! 6. Analyze the data in MINITAB. (a) Copy and paste the new time series Z from Excel file Simdata to MINITAB project file Simdata. (b) Apply ACF and PACF plots to Z. We know from construction that Zt ∼ MA(1). Yet which two ARMA models are indicated as possible models from ACF and PACF diagnostics? (c) Fit the two models in MINITAB. Consider model adequacy. 7. Analyze the data in JMP. (a) Fit both models in JMP. Examine residuals plots for each. Which model fits better, according to AIC? (b) Is the estimated parameter θb1 in MA(1) close to the known value θ1 = −0.6? 4 IV. Simulating ARMA(1,1) 1. Use Exercise 7.3 (d) — what are the values of φ1 and θ1 that we’ll use? 2. Return to the Simdata Excel file. 3. Manually calculate the first few terms of Xt ∼ ARMA(1,1): Xt = c + φ1 Xt−1 − θ1 et−1 + et = (0.6)Xt−1 + (0.6)et−1 + et (a) X1 = (0.6)X0 + (0.6)e0 + e1 = (0.6)(0) + (0.6)(0) + e1 = 0.01 (b) X2 = (0.6)X1 + (0.6)e1 + e2 = (0.6)(0.01) + (0.6)(0.01) + 1.38 = 0.006 + 0.006) + 1.38 = 1.392 (c) Calculate X3 NOW on your own! What’s your answer? X3 = ? 4. Create an Excel formula to recursively calculate Xt . Figure this one out yourself! (If you’re successful you should end with X30 = −0.26376. If having any trouble ask a team member or classmate for help.) 5. Save the Excel file Simdata again! 6. Analyze the data X in MINITAB. Plot the X time series. Identify at least two plausible models with acceptable residuals, significant parameters, etc. 7. Analyze the data X in JMP. Use AIC to choose the best of the two plausible models identified in MINITAB. Is the “best-fitting” model (according to AIC) also the correct one? 5