**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:

`AER`(Christian Kleiber and Zeileis 2008),`dynlm`(Zeileis 2019),`forecast`(Hyndman et al. 2023),`readxl`(Wickham and Bryan 2023),`stargazer`(Hlavac 2022),`scales`(Wickham and Seidel 2022),`quantmod`(Ryan and Ulrich 2023),`urca`(B. Pfaff 2008).

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

### References

*Stargazer: Well-Formatted Regression and Summary Statistics Tables*. Bratislava, Slovakia: Social Policy Institute. https://CRAN.R-project.org/package=stargazer.

*forecast: Forecasting Functions for Time Series and Linear Models*(version 8.21.1). https://pkg.robjhyndman.com/forecast/.

*Applied Econometrics with R*. New York: Springer-Verlag. https://CRAN.R-project.org/package=AER.

*Analysis of Integrated and Cointegrated Time Series with r*. Second. New York: Springer. https://www.pfaffikus.de.

*quantmod: Quantitative Financial Modelling Framework*(version 0.4.25). http://www.quantmod.com.

*readxl: Read Excel Files*(version 1.4.3). https://readxl.tidyverse.org.

*scales: Scale Functions for Visualization*(version 1.2.1). https://scales.r-lib.org.

*dynlm: Dynamic Linear Regression*. https://CRAN.R-project.org/package=dynlm.