This book is in Open Review. We want your feedback to make the book better for you and other students. You may annotate some text by selecting it with the cursor and then click "Annotate" in the pop-up menu. You can also see the annotations of others: click the arrow in the upper right hand corner of the page

14 Introduction to Time Series Regression and Forecasting

Time series data is collected for a single entity over time. This is fundamentally different from cross-section data which is data on multiple entities at the same point in time. Time series data allows estimation of the effect on \(Y\) of a change in \(X\) over time. This is what econometricians call a dynamic causal effect. Let us go back to the application of cigarette consumption of Chapter 12 where we were interested in estimating the effect on cigarette demand of a price increase caused by a raise of the general sales tax. One might use time series data to assess the causal effect of a tax increase on smoking both, initially and in subsequent periods.

Another application of time series data is forecasting. For example, weather services use time series data to predict tomorrow’s temperature by, inter alia, using today’s temperature and temperatures of the past. To motivate an economic example, central banks are interested in forecasting next month’s unemployment rates.

The remaining chapters in the book deal with econometric techniques for analyzing time series data, as well as their applications in forecasting and estimating dynamic causal effects. This section covers the basic concepts presented in Chapter 14 of the book, explains how to visualize time series data and demonstrates how to estimate simple autoregressive models, where the regressors are past values of the dependent variable or other variables. In this context we also discuss the concept of stationarity, an important property which has far-reaching consequences.

Most empirical applications in this chapter are concerned with forecasting and use data on U.S. macroeconomic indicators or financial time series like Gross Domestic Product (GDP), the unemployment rate or excess stock returns.

The following packages and their dependencies are needed for reproduction of the code chunks presented throughout this chapter:

Please verify that the following code chunk runs on your machine without any errors.

library(AER)
library(dynlm)
library(forecast)
library(readxl)
library(stargazer)
library(scales)
library(quantmod)
library(urca)

References

Hlavac, Marek. 2022. Stargazer: Well-Formatted Regression and Summary Statistics Tables. Bratislava, Slovakia: Social Policy Institute. https://CRAN.R-project.org/package=stargazer.
Hyndman, Rob, George Athanasopoulos, Christoph Bergmeir, Gabriel Caceres, Leanne Chhay, Kirill Kuroptev, Mitchell O’Hara-Wild, et al. 2023. forecast: Forecasting Functions for Time Series and Linear Models (version 8.21.1). https://pkg.robjhyndman.com/forecast/.
Kleiber, Christian, and Achim Zeileis. 2008. Applied Econometrics with R. New York: Springer-Verlag. https://CRAN.R-project.org/package=AER.
Pfaff, B. 2008. Analysis of Integrated and Cointegrated Time Series with r. Second. New York: Springer. https://www.pfaffikus.de.
Ryan, Jeffrey A., and Joshua M. Ulrich. 2023. quantmod: Quantitative Financial Modelling Framework (version 0.4.25). http://www.quantmod.com.
Wickham, Hadley, and Jennifer Bryan. 2023. readxl: Read Excel Files (version 1.4.3). https://readxl.tidyverse.org.
Wickham, Hadley, and Dana Seidel. 2022. scales: Scale Functions for Visualization (version 1.2.1). https://scales.r-lib.org.
Zeileis, Achim. 2019. dynlm: Dynamic Linear Regression. https://CRAN.R-project.org/package=dynlm.