Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > # Directories
- > setwd("directory")
- > mydata<- read.csv("mly532.csv")
- > attach(mydata)
- The following objects are masked from mydata (pos = 4):
- date, maxtp
- The following objects are masked from mydata (pos = 8):
- date, maxtp
- The following objects are masked from mydata (pos = 9):
- date, maxtp
- The following objects are masked from mydata (pos = 14):
- date, maxtp
- >
- > # Load libraries
- > library(MASS)
- > library(tseries)
- > library(forecast)
- >
- > # Plot and convert to ln format
- > lnweather=log(mydata$maxtp[1:741])
- > lnweather
- [1] 2.639057 2.541602 2.476538 2.451005 2.785011 2.785011
- [7] 3.039749 3.182212 3.100092 3.104587 3.049273 2.944439
- ........
- [733] 2.766319 2.595255 2.541602 2.509599 2.681022 2.912351
- [739] 3.095578 3.034953 3.173878
- >
- > # ACF, PACF and Dickey-Fuller Test
- > acf(lnweather, lag.max=20)
- > pacf(lnweather, lag.max=20)
- > adf.test(lnweather)
- Augmented Dickey-Fuller Test
- data: lnweather
- Dickey-Fuller = -9.2629, Lag order = 9, p-value = 0.01
- alternative hypothesis: stationary
- Warning message:
- In adf.test(lnweather) : p-value smaller than printed p-value
- > # Time series and seasonality
- > weatherarima <- ts(lnweather, start = c(1941,11), frequency = 12)
- > plot(weatherarima,type="l")
- > title("Maximum Air Temperature - Dublin")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement