Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. > # Directories
  2. > setwd("directory")
  3. > mydata<- read.csv("mly532.csv")
  4. > attach(mydata)
  5. The following objects are masked from mydata (pos = 4):
  6.  
  7. date, maxtp
  8.  
  9. The following objects are masked from mydata (pos = 8):
  10.  
  11. date, maxtp
  12.  
  13. The following objects are masked from mydata (pos = 9):
  14.  
  15. date, maxtp
  16.  
  17. The following objects are masked from mydata (pos = 14):
  18.  
  19. date, maxtp
  20.  
  21. >
  22. > # Load libraries
  23. > library(MASS)
  24. > library(tseries)
  25. > library(forecast)
  26. >
  27. > # Plot and convert to ln format
  28. > lnweather=log(mydata$maxtp[1:741])
  29. > lnweather
  30. [1] 2.639057 2.541602 2.476538 2.451005 2.785011 2.785011
  31. [7] 3.039749 3.182212 3.100092 3.104587 3.049273 2.944439
  32. ........
  33. [733] 2.766319 2.595255 2.541602 2.509599 2.681022 2.912351
  34. [739] 3.095578 3.034953 3.173878
  35. >
  36. > # ACF, PACF and Dickey-Fuller Test
  37. > acf(lnweather, lag.max=20)
  38. > pacf(lnweather, lag.max=20)
  39. > adf.test(lnweather)
  40.  
  41. Augmented Dickey-Fuller Test
  42.  
  43. data: lnweather
  44. Dickey-Fuller = -9.2629, Lag order = 9, p-value = 0.01
  45. alternative hypothesis: stationary
  46.  
  47. Warning message:
  48. In adf.test(lnweather) : p-value smaller than printed p-value
  49.  
  50. > # Time series and seasonality
  51. > weatherarima <- ts(lnweather, start = c(1941,11), frequency = 12)
  52. > plot(weatherarima,type="l")
  53. > title("Maximum Air Temperature - Dublin")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement