Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ARIMA Modeling
© EduPristine – www.edupristine.com/ca
© EduPristine | Business Analytics
Agenda
▪ Introduction
▪ Data
▪ Basic Statistics
▪ Predictive modeling using Linear Regression
▪ Logistic Regression
▪ Forecasting using Time Series Techniques
▪ ARIMA Modeling
▪ Linear Regression – Revise
▪ Scorecard Development
▪ Churn Analytics
▪ Market Basket Analysis
▪ Clustering
▪ Decision Trees
▪ Time Series
▪ AR, MA, and ARMA models
▪ I in ARIMA
• Stationarity
• Detrending
• Differencing
• Seasonality
▪ ACF and PACF
▪ Dickey – Fuller Test
▪ Time Series – A sequence of data points, measured over equal intervals of time
▪ Forecasting – predicting the future
▪ Time Series Analysis
• Linear Regression has an assumption that, the value is independent of its own previous values
• In Time series, there are time when today’s value depends on yesterday’s value (yt is dependent on yt-1)
▪ White Noise
• White Noise is an assumption where each data point in time-series should be random with mean equal to
zero and constant variance
▪ In case there is white noise assumption violation, AR (Autoregressive) and MA (Moving Average)
models correct of this violation
X t 1 0 1 X t et 1
▪ “The AR(1) model expresses what we don’t know in terms of what we do know at time t"
“The AR(1) model expresses what we don’t know in terms of what we do know at time t"
Beta = 0.7 Beta = -0.7
4.50
2.00
4.00
3.50 1.50
3.00
1.00
2.50
2.00 0.50
1.50
1.00 0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
0.50
-0.50
0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
-1.00
X t et 1et 1 2 et 2 ... q et q
▪ “Current value of Xt can be found from past shocks/error (e), plus a new shock/error (et)"
▪ “ The time series is regarded as a moving average (unevenly weighted, because of different coefficients)
of a random shock series et"
▪ The MA(1) model: “A first order moving average model would look like":
X t et 1et 1
▪ If 1 is zero, X depends purely on the error or shock (e) at the current time, and there is no temporal
dependence
Beta = 0.7
2.00
1.50
1.00
0.50
0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
-0.50
Beta = -0.7
2.50
2.00
1.50
1.00
0.50
0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
-0.50
▪ ARMA models are only suited for time series stationary in mean and variance
▪ A mixture of these two types of model would be referred to as an autoregressive moving average model
(ARMA)p, q, where p is the order of the autoregressive part and q is the order of the moving average
term.
▪ Mixed ARMA models
"An ARMA process of the order (p, q)“
X t 0 1 X t 1 et
▪ The above process is stationary when |1| < 1, and et is white noise
▪ Following data stationary or not?
Original Data
12.00
10.00
8.00
6.00
4.00
2.00
0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
▪ When we have time trend, we can get the stationarity by detrending the variable
▪ A variable can be detrended by getting the residuals
X t 0 1 X t 1 et
▪ Detrending:
et X t ( 0 1 X t 1 )
2.50 0.20
0.00
2.00 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
-0.20
1.50 -0.40
1.00 -0.60
-0.80
0.50
-1.00
0.00
-1.20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
▪ ARIMA – "Type of ARMA model that can be used with some kinds of non-stationary data“
▪ When the data is non-stationary, we can use differenced series
ΔXt = Xt – Xt-1
▪ This process is called First order or “simple” differencing“
▪ Series with deterministic trends should be differenced first then an ARMA model applied
▪ "The “I” in ARIMA stands for integrated, which basically means you’re differencing“
3.50
1.00
3.00
2.50 0.50
2.00
1.50 0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
1.00
-0.50
0.50
0.00
-1.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
“The autocorrelation function (ACF) is a set of correlation coefficients between the series and lags of
itself over time"
“The partial autocorrelation function (PACF) is the partial correlation coefficients between the series
and lags of itself over time"
▪ Amount of correlation between a variable and a lag of itself that is not explained by correlations
at all lower-order-lags
• Correlation at lag 1 “propagates” to lag 2 and presumably to higher- order lags
• PA at lag 2 is difference between the actual correlation at lag 2 and expected correlation due to propagation
of correlation at lag
The autocorrelations of a pure AR(p) process should decay gradually at increasing lag length. Hence, using
an autocorrelogram it is not possible to differentiate between a pure AR(3) model or a pure AR(4) model.
However, the partial autocorrelations of a pure AR(p) process do display distinctive features. The partial
autocorrelogram should ‘die out’ after p lags. Thus, the partial autocorrelogram of a pure AR(3) process
should die out after 3 lags, whereas that of a pure AR(4) process would die out after 4 lags.
X t et 1et 1
▪ If 1 is zero, X depends purely on the error or shock (e) at the current time, and there is no temporal
dependence
The behaviour of correlograms and partial autocorrelograms for pure MA(q) processes is the reverse of
that for pure AR processes. The autocorrelogram of a pure MA(q) process should ‘die out’ after q lags. The
partial autocorrelogram of a pure MA process, on the other hand, only decays slowly over time (similar to
the behaviour of the autocorrelogram of a pure AR process). Thus, it should be impossible to distinguish
between the PACF of an MA(3) and MA(4) process, whereas the ACF of the MA(3) process should decay to
zero after 3 lags and the MA(4) process after 4 lags.
You are a sales Manager of a leading Automobile manufacturer and you have been asked to
forecast next 8 months sales. You have been given with historical sales data of the automobiles.
You have thought to apply ARIMA model in R.
#Let's look at the graph of the data, to identify visually if the data is stationary or not
plot(sa)
help@edupristine.com
www.edupristine.com/ca
© EduPristine – www.edupristine.com/ca
© EduPristine | Business Analytics