0% found this document useful (0 votes)
16 views19 pages

ARIMA Models in R: A Comprehensive Guide

The document discusses autoregressive integrated moving average (ARIMA) models in R. It covers identifying ARIMA processes from differenced time series data, examining autocorrelation functions of integrated and differenced ARIMA processes, fitting an ARIMA(1,1,1) model to weekly oil price data, checking for overfitting by comparing ARIMA(2,1,1) and ARIMA(1,1,2) models, and forecasting with ARIMA models using the sarima.for() function in R. The document is presented by David Stoffer, a professor of statistics at the University of Pittsburgh.

Uploaded by

Abdellah Chaoui
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views19 pages

ARIMA Models in R: A Comprehensive Guide

The document discusses autoregressive integrated moving average (ARIMA) models in R. It covers identifying ARIMA processes from differenced time series data, examining autocorrelation functions of integrated and differenced ARIMA processes, fitting an ARIMA(1,1,1) model to weekly oil price data, checking for overfitting by comparing ARIMA(2,1,1) and ARIMA(1,1,2) models, and forecasting with ARIMA models using the sarima.for() function in R. The document is presented by David Stoffer, a professor of statistics at the University of Pittsburgh.

Uploaded by

Abdellah Chaoui
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ARIMA - integrated

ARMA
ARIMA MODELS IN R

David Stoffer
Professor of Statistics at the University
of Pittsburgh
Identifying ARIMA
A time series exhibits ARIMA behavior if the differenced data
has ARMA behavior

# Simulation ARIMA(p = 1, d = 1, q = 0)
x <- [Link](list(order = c(1, 1, 0), ar = .9), n = 200)
plot(x, main = "ARIMA(p = 1, d = 1, q = 0)")
plot(diff(x), main = "ARMA(p = 1, d = 0, q = 0)")

ARIMA MODELS IN R
ACF and PCF of an Integrated ARMA
x <- [Link](list(order = c(1, 1, 0), ar = .9), n = 200)
acf2(x)

ARIMA MODELS IN R
ACF and PCF of a Differenced ARIMA
x <- [Link](list(order = c(1, 1, 0), ar = .9), n = 200)
acf2(diff(x))

ARIMA MODELS IN R
ACF and PCF of a Differenced ARIMA
x <- [Link](list(order = c(1, 1, 0), ar = .9), n = 200)
acf2(diff(x))

ARIMA MODELS IN R
Weekly Oil Prices

ARIMA MODELS IN R
Weekly Oil Prices

Looks like ARIMA(1, 1, 1)

ARIMA MODELS IN R
Let's practice!
ARIMA MODELS IN R
ARIMA diagnostics
ARIMA MODELS IN R

David Stoffer
Professor of Statistics at the University
of Pittsburgh
Weekly Oil Prices ARIMA(1, 1, 1)?

ARIMA MODELS IN R
Weekly Oil Prices ARIMA(1, 1, 1)?

ARIMA MODELS IN R
Weekly Oil Prices ARIMA(1, 1, 1)?
oil <- window(oil, end = 2006)
x <- sarima(oil, p = 1, d = 1, q = 1)
x$ttable

Estimate SE [Link] [Link]


ar1 -0.4987 0.0995 -5.0131 0.0000
ma1 0.7316 0.0734 9.9732 0.0000
constant 0.1091 0.0936 1.1664 0.2443

ARIMA MODELS IN R
Weekly Oil Prices ARIMA(1, 1, 1)!

ARIMA MODELS IN R
Overfit: ARIMA(2, 1, 1) and ARIMA(1, 1, 2)
oil_fit1 <- sarima(oil, p = 2, d = 1, q = 1)
oil_fit1$ttable

Estimate SE [Link] [Link]


ar1 -0.4704 0.1117 -4.2121 0.0000
ar2 -0.0738 0.0652 -1.1319 0.2586
ma1 0.6771 0.0986 6.8696 0.0000
constant 0.1088 0.0878 1.2391 0.2163

oil_fit2 <- sarima(oil, p = 1, d = 1, q = 2)


oil_fit2$ttable

Estimate SE [Link] [Link]


ar1 -0.3664 0.1816 -2.0178 0.0445
ma1 0.5777 0.1818 3.1777 0.0016
ma2 -0.0836 0.0837 -0.9989 0.3186
constant 0.1088 0.0884 1.2306 0.2194

ARIMA MODELS IN R
Let's practice!
ARIMA MODELS IN R
Forecasting ARIMA
ARIMA MODELS IN R

David Stoffer
Professor of Statistics at the University
of Pittsburgh
Forecasting ARIMA Processes
The model describes how the dynamics of the time series
behave over time

Forecasting simply continues the model dynamics into the


future

Use [Link]() to forecast in the astsa-package

ARIMA MODELS IN R
Forecasting ARIMA Processes
oil <- window(astsa::oil, end = 2006)
oilf <- window(astsa::oil, end = 2007)
[Link](oil, [Link] = 52, 1, 1, 1)
lines(oilf)

ARIMA MODELS IN R
Let's practice!
ARIMA MODELS IN R

You might also like