SHARE
TWEET

DynEcon

a guest May 21st, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ### a)
  2. ```{r ex1a}
  3. fedfunds <- ts(DynamicEconometrics[,2], start = c(1959, 01), frequency = 12)
  4. autoplot(fedfunds)
  5.  
  6. cpiaucsl <- ts(DynamicEconometrics[,3], start = c(1959, 01), frequency = 12)
  7. autoplot(cpiaucsl)
  8. ```
  9. ### b)
  10. ```{r ex1b}
  11. diff_fedfunds <- 100*diff(fedfunds)
  12. autoplot(diff_fedfunds)
  13. ```
  14. ### c)
  15. ```{r ex1c}
  16. library('readxl')# To read Excel files
  17. library('fpp2')# For forecasting
  18. library('tseries')# To estimate ARMA models
  19. library('urca')# For the Dickey Fuller test
  20.  
  21. adf.test(fedfunds, alternative="stationary", k=0)
  22. adf.test(log(fedfunds), alternative="stationary", k=0)
  23. adf.test(diff(fedfunds), alternative="stationary", k=0)
  24. ```
  25. ### d)
  26. ```{r ex1d}
  27. diffsquaredlog_cpiaucsl <- 100*diff(diff(log(cpiaucsl)))
  28. autoplot(diffsquaredlog_cpiaucsl)
  29. ```
  30.  
  31. ### e)
  32. ```{r ex1e}
  33. adf.test(cpiaucsl, alternative="stationary", k=0)
  34. adf.test(log(cpiaucsl), alternative="stationary", k=0)
  35. adf.test(diff(cpiaucsl), alternative="stationary", k=0)
  36. adf.test(diff(log(cpiaucsl)), alternative="stationary", k=0)
  37. adf.test(diff(diff(log(cpiaucsl))), alternative="stationary", k=0)
  38.  
  39. autoplot(cpiaucsl)
  40. autoplot(log(cpiaucsl))
  41. autoplot(diff(cpiaucsl))
  42. autoplot(diff(log(cpiaucsl)))
  43. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top