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 the on the pop-up menu. You can also see the annotations of others: click the in the upper right hand corner of the page

# 15 Estimation of Dynamic Causal Effects

It sometimes is of interest to know the size of current and future reaction of $Y$ to a change in $X$. This is called the dynamic causal effect on $Y$ of a change in $X$. This Chapter we discusses how to estimate dynamic causal effects in R applications, where we investigate the dynamic effect of cold weather in Florida on the price of orange juice concentrate.

The discussion covers:

• estimation of distributed lag models
• heteroskedasticity- and autocorrelation-consistent (HAC) standard errors
• generalized least squares (GLS) estimation of ADL models

To reproduce code examples, install the R packages listed below beforehand and make sure that the subsequent code chunk executes without any errors.

• AER (Kleiber & Zeileis, 2017)
• dynlm (Zeileis, 2016)
• nlme (Pinheiro, Bates, & R-core, 2018)
• orcutt (Spada, 2018)
• quantmod (Ryan & Ulrich, 2018)
• stargazer (Hlavac, 2018)
library(AER)
library(quantmod)
library(dynlm)
library(orcutt)
library(nlme)
library(stargazer)

### References

Kleiber, C., & Zeileis, A. (2017). AER: Applied Econometrics with R (Version 1.2-5). Retrieved from https://CRAN.R-project.org/package=AER

Zeileis, A. (2016). dynlm: Dynamic Linear Regression (Version 0.3-5). Retrieved from https://CRAN.R-project.org/package=dynlm

Pinheiro, J., Bates, D., & R-core. (2018). nlme: Linear and Nonlinear Mixed Effects Models (Version 3.1-137). Retrieved from https://CRAN.R-project.org/package=nlme

Spada, S. (2018). orcutt: Estimate Procedure in Case of First Order Autocorrelation (Version 2.3). Retrieved from https://CRAN.R-project.org/package=orcutt

Ryan, J. A., & Ulrich, J. M. (2018). quantmod: Quantitative Financial Modelling Framework (Version 0.4-13). Retrieved from https://CRAN.R-project.org/package=quantmod

Hlavac, M. (2018). stargazer: Well-Formatted Regression and Summary Statistics Tables (Version 5.2.2). Retrieved from https://CRAN.R-project.org/package=stargazer