lecture 7
play

Lecture 7 AR Models 2/08/2018 1 Lagged Predictors and CCFs 2 - PowerPoint PPT Presentation

Lecture 7 AR Models 2/08/2018 1 Lagged Predictors and CCFs 2 Southern Oscillation Index & Recruitment 0.137 0.104 68.6 ## 5 1950 -0.0160 68.6 ## 6 1950 0.235 68.6 ## 7 1950 59.2 4 ## 8 1951 0.191 48.7 ## 9 1951


  1. Lecture 7 AR Models 2/08/2018 1

  2. Lagged Predictors and CCFs 2

  3. Southern Oscillation Index & Recruitment 0.137 0.104 68.6 ## 5 1950 -0.0160 68.6 ## 6 1950 0.235 68.6 ## 7 1950 59.2 4 ## 8 1951 0.191 48.7 ## 9 1951 -0.0160 47.5 ## 10 1951 0.290 50.9 ## # ... with 443 more rows 1950 ## The Southern Oscillation Index (SOI) is an indicator of the development and <dbl> intensity of El Niño (negative SOI) or La Niña (positive SOI) events in the Pacific Ocean. These data also included the estimate of “recruitment”, which indicate fish population sizes in the southern hemisphere. ## ## Attaching package: 'astsa' ## The following object is masked from 'package:forecast': ## ## gas ## # A tibble: 453 x 3 ## date soi recruitment ## <dbl> 68.6 1950 0.311 1950 3 ## 68.6 0.246 2 <dbl> ## 68.6 0.377 1950 1 ## 3

  4. Time series 4 recruitment 100 75 50 25 Variables 0 recruitment soi soi 1.0 0.5 0.0 −0.5 −1.0 1950 1960 1970 1980 date

  5. Relationship? 5 100 75 recruitment 50 25 0 −1.0 −0.5 0.0 0.5 1.0 soi

  6. soi s ACF & PACF forecast:: ggtsdisplay (fish$soi, lag.max = 36) 6 fish$soi 1.0 0.5 0.0 −0.5 −1.0 0 100 200 300 400 0.6 0.6 0.4 0.4 0.2 PACF 0.2 ACF 0.0 0.0 −0.2 −0.2 −0.4 −0.4 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag

  7. recruitment forecast:: ggtsdisplay (fish$recruitment, lag.max = 36) 7 fish$recruitment 100 75 50 25 0 0 100 200 300 400 0.5 0.5 PACF ACF 0.0 0.0 −0.5 −0.5 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag

  8. Cross correlation function with (fish, forecast:: ggCcf (soi, recruitment)) 8 Series: soi & recruitment 0.2 0.0 CCF −0.2 −0.4 −0.6 −20 −10 0 10 20 Lag

  9. Cross correlation function - Scatter plots 9 lag 0 lag 1 lag 2 lag 3 120 90 60 30 0.025 0.011 −0.042 −0.146 0 lag 4 lag 5 lag 6 lag 7 120 recruitment 90 60 30 −0.299 −0.53 −0.602 −0.602 0 lag 8 lag 9 lag 10 lag 11 120 90 60 30 −0.565 −0.481 −0.374 −0.27 0 −1.0 −0.5 0.0 0.5 1.0−1.0 −0.5 0.0 0.5 1.0−1.0 −0.5 0.0 0.5 1.0−1.0 −0.5 0.0 0.5 1.0 soi

  10. Model -7.839 3.46e-14 *** ## lag(soi, 5) -19.1502 2.9508 -6.490 2.32e-10 *** ## lag(soi, 6) -15.6894 3.4334 -4.570 6.36e-06 *** ## lag(soi, 7) -13.4041 3.4332 -3.904 0.000109 *** ## lag(soi, 8) -23.1480 2.9530 ## --- 73.007 ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 18.93 on 440 degrees of freedom ## (8 observations deleted due to missingness) ## Multiple R-squared: 0.5539, Adjusted R-squared: 0.5498 ## F-statistic: 136.6 on 4 and 440 DF, p-value: < 2.2e-16 < 2e-16 *** 0.9306 model1 = lm (recruitment~ lag (soi,6), data=fish) 67.9438 summary (model3) ## ## Call: ## lm(formula = recruitment ~ lag(soi, 5) + lag(soi, 6) + lag(soi, ## 7) + lag(soi, 8), data = fish) ## ## Residuals: ## Min 1Q Median 3Q Max ## -72.409 -13.527 0.191 12.851 46.040 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 10 model2 = lm (recruitment~ lag (soi,6)+ lag (soi,7), data=fish) model3 = lm (recruitment~ lag (soi,5)+ lag (soi,6)+ lag (soi,7)+ lag (soi,8), data=fish)

  11. Prediction 11 Model 1 − soi lag 6 (RMSE: 22.4) 125 100 75 50 25 0 Model 2 − soi lags 6,7 (RMSE: 20.8) 125 recruitment 100 75 50 25 0 Model 3 − soi lags 5,6,7,8 (RMSE: 18.8) 125 100 75 50 25 0 1950 1960 1970 1980 date

  12. Residual ACF - Model 3 12 residuals(model3) 50 25 0 −25 −50 −75 0 100 200 300 400 0.9 0.9 0.6 0.6 PACF ACF 0.3 0.3 0.0 0.0 −0.3 −0.3 0 5 10 15 20 25 0 5 10 15 20 25 Lag Lag

  13. Autoregessive model 1 9.71918 -0.767 1.31912 -1.01131 ## lag(soi, 7) 6.220 1.16e-09 *** 1.56265 ## lag(soi, 6) ## lag(soi, 8) < 2e-16 *** 1.09906 -18.892 -20.76309 ## lag(soi, 5) < 2e-16 *** -9.995 0.03998 0.4437 -2.29814 ## lag(recruitment, 2) (8 observations deleted due to missingness) p-value: < 2.2e-16 1115 on 6 and 438 DF, ## F-statistic: 0.9377 0.9385, Adjusted R-squared: ## Multiple R-squared: ## 1.20730 ## Residual standard error: 7.042 on 438 degrees of freedom ## 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## Signif. codes: ## --- 0.0576 . -1.904 -0.39961 < 2e-16 *** model4 = lm (recruitment~ lag (recruitment,1) + lag (recruitment,2) + ## 1Q Min ## ## Residuals: ## data = fish) 2) + lag(soi, 5) + lag(soi, 6) + lag(soi, 7) + lag(soi, 8), 3Q ## ## lm(formula = recruitment ~ lag(recruitment, 1) + lag(recruitment, ## Call: ## summary (model4) data=fish) lag (soi,5)+ lag (soi,6)+ lag (soi,7)+ lag (soi,8), Median Max 29.061 ## (Intercept) 0.04312 1.25301 ## lag(recruitment, 1) < 2e-16 *** 8.755 1.17081 10.25007 Estimate Std. Error t value Pr(>|t|) ## -51.996 ## ## Coefficients: ## 28.579 3.117 0.103 -2.892 13

  14. Autoregessive model 2 1.43146 28.879 < 2e-16 *** ## lag(recruitment, 2) -0.37193 0.03846 -9.670 < 2e-16 *** ## lag(soi, 5) -20.83776 1.10208 -18.908 < 2e-16 *** ## lag(soi, 6) 8.55600 5.977 4.68e-09 *** 1.24575 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 7.069 on 442 degrees of freedom ## (6 observations deleted due to missingness) ## Multiple R-squared: 0.9375, Adjusted R-squared: 0.937 ## F-statistic: 1658 on 4 and 442 DF, p-value: < 2.2e-16 0.04314 ## lag(recruitment, 1) model5 = lm (recruitment~ lag (recruitment,1) + lag (recruitment,2) + Median lag (soi,5) + lag (soi,6), data=fish) summary (model5) ## ## Call: ## lm(formula = recruitment ~ lag(recruitment, 1) + lag(recruitment, ## 2) + lag(soi, 5) + lag(soi, 6), data = fish) ## ## Residuals: ## Min 1Q 3Q < 2e-16 *** Max ## -53.786 -2.999 -0.035 3.031 27.669 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 8.78498 1.00171 8.770 14

  15. Prediction 15 Model 3 − soi lags 5,6,7,8 (RMSE: 18.82) 125 100 75 50 25 0 Model 4 − AR(2); soi lags 5,6,7,8 (RMSE: 6.99) 125 recruitment 100 75 50 25 0 Model 5 − AR(2); soi lags 5,6 (RMSE: 7.03) 125 100 75 50 25 0 1950 1960 1970 1980 date

  16. Residual ACF - Model 5 forecast:: ggtsdisplay ( residuals (model5)) 16 residuals(model5) 20 0 −20 −40 0 100 200 300 400 0.1 0.1 0.0 0.0 PACF ACF −0.1 −0.1 0 5 10 15 20 25 0 5 10 15 20 25 Lag Lag

  17. Non-stationarity 17

  18. 𝑧 𝑢 = 𝜈(𝑢) + 𝑥 𝑢 where 𝜈(𝑢) denotes a time dependent trend and 𝑥 𝑢 is a white noise Non-stationary models All happy families are alike; each unhappy family is unhappy in its own way. • Tolstoy, Anna Karenina This applies to time series models as well, just replace happy family with stationary model. A simple example of a non-stationary time series is a trend stationary model (stationary) process. 18

  19. Non-stationary models All happy families are alike; each unhappy family is unhappy in its own way. • Tolstoy, Anna Karenina This applies to time series models as well, just replace happy family with stationary model. A simple example of a non-stationary time series is a trend stationary model (stationary) process. 18 𝑧 𝑢 = 𝜈(𝑢) + 𝑥 𝑢 where 𝜈(𝑢) denotes a time dependent trend and 𝑥 𝑢 is a white noise

  20. Linear trend model 19 Lets imagine a simple model where 𝑧 𝑢 = 𝜀 + 𝛾𝑢 + 𝑦 𝑢 where 𝜀 and 𝛾 are constants and 𝑦 𝑢 is a stationary process. Linear trend 12 9 6 y 3 0 0 25 50 75 100 t

  21. Differencing An simple approach to remove tremd is to difference your response variable, 20 specifically examine 𝑧 𝑢 − 𝑧 𝑢−1 instead of 𝑧 𝑢 .

  22. Detrending vs Difference 21 Detrended 3 2 1 resid 0 −1 −2 −3 0 25 50 75 100 t Differenced 2 y_diff 0 −2 0 25 50 75 100 t

  23. Quadratic trend model 22 Lets imagine another simple model where 𝑧 𝑢 = 𝜀 + 𝛾𝑢 + 𝛿𝑢 2 + 𝑦 𝑢 where 𝜀 , 𝛾 , and 𝛿 are constants and 𝑦 𝑢 is a stationary process. Quadratic trend 7.5 5.0 y 2.5 0.0 0 25 50 75 100 t

  24. Detrending 23 Detrended − Linear 4 2 resid 0 −2 −4 0 25 50 75 100 t Detrended − Quadratic 2 1 resid 0 −1 −2 0 25 50 75 100 t

  25. 2nd order differencing order difference. 24 Let 𝑒 𝑢 = 𝑧 𝑢 − 𝑧 𝑢−1 be a first order difference then 𝑒 𝑢 − 𝑒 𝑢−1 is a 2nd

  26. Differencing 25 1st Difference 4 2 y_diff 0 −2 0 25 50 75 100 t 2nd Difference 4 y_diff 0 −4 0 25 50 75 100 t

  27. Differencing - ACF 26 Series: qt$y Series: qt$y 0.75 0.75 0.50 0.50 PACF ACF 0.25 0.25 0.00 0.00 −0.25 5 10 15 20 5 10 15 20 Lag Lag Series: diff(qt$y) Series: diff(qt$y) 0.4 0.25 0.2 PACF ACF 0.00 0.0 −0.2 −0.25 −0.4 −0.50 5 10 15 5 10 15 Lag Lag Series: diff(qt$y, differences = 2) Series: diff(qt$y, differences = 2) 0.25 0.00 PACF ACF 0.00 −0.25 −0.25 −0.50 −0.50 −0.75 −0.75 5 10 15 5 10 15 Lag Lag

  28. AR Models 27

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend