The story so far…• time series classes in R
• simple and naive forecasts
• simple linear regressions
• dummy variables
• data transformations
• scaling series
• stationarity and autocorrelation
• decomposing time series
• Holt-Winters
Stationarity
• A stationary time series is one whose properties do not depend on the time at which the series is observed.
• No trends, or seasonality.
Differencing
• Use the diff( ) function
• Inputs are lag (lag window) and differences (order of differences)
• Order is whether it’s first derivative difference, second derivative, etc.
Differences (contd.)• Differences variable is the
order of the differences…i.e. how many levels down the differences are
• Think of it as the differences of the differences
Unit Root Tests• Test to see if data is
non-stationary
• Augmented Dickey-Fuller test is a popular option (adf.test function)
• ADF assumes that data is non-stationary, and tests the likelihood of the alternative hypothesis
ARIMA Models
• Autoregressive (AR) models forecast the variable of interest based on past historic data of the variable itself
• Moving Average (MA) models use prior forecast errors to create a regression model
• ARIMA models combine these two types of models…AutoRegressive Integrated Moving Averages
ARIMA (contd.)
The standard ARIMA model is called an ARIMA(p,d,q) where:
• p = order of the autoregressive part
• d = degree of first differencing involved
• q = order of the moving average part
This model is non-seasonal
Seasonal ARIMA models• ARIMA (p,d,q) (P,D,Q)m where m is the number of
periods in a season
• You can use auto.arima( ) to choose these as well