This chapter, as Chapter 7, uses Jordà (2005) Local Projection framework to measure how sensitive agricultural output is to exogenous changes in the weather. The differences lies in the fact that the weather variables are included with first order and second order term in the equations.
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ ggplot2 3.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.0
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# Functions useful to shape the data for local projectionssource("../weatherperu/R/format_data.R")# Load function in utilssource("../weatherperu/R/utils.R")# Load detrending functionssource("../weatherperu/R/detrending.R")# Estimation functionssource("../weatherperu/R/estimations.R")
8.1 Linear Local Projections
In this section, we focus on estimating the Local Projections (Jordà 2005) to quantify the impact of weather on agricultural production. We utilize panel data, similar to the approach used in the study by Acevedo et al. (2020), and independently estimate models for each specific crop.
For a particular crop denoted as \(c\), the model can be expressed as follows: \[
\begin{aligned}
\underbrace{y_{c,i,{\color{wongGold}t+h}}}_{\text{Production}} = & \underbrace{\alpha_{c,i,h}}_{\text{reg. fixed effect}} + {\color{wongOrange}\beta_{c,{\color{wongGold}h}}^{{\color{wongPurple}T}}} {\color{wongPurple}{T_{i,{\color{wongGold}t}}}} +
{\color{wongOrange}\beta_{c,{\color{wongGold}h}}^{{\color{wongPurple}T^2}}} {\color{wongPurple}{T^2_{i,{\color{wongGold}t}}}} +
{\color{wongOrange}\beta_{c,{\color{wongGold}h}}^{{\color{wongPurple}P}}} {\color{wongPurple}P_{i,{\color{wongGold}t}}} +
{\color{wongOrange}\beta_{c,{\color{wongGold}h}}^{{\color{wongPurple}P^2}}} {\color{wongPurple}P^2_{i,{\color{wongGold}t}}}\\
&+\delta_{c,i,h}\underbrace{X_{t}}_{\text{controls}}+\varepsilon_{c,i,t+h}
\end{aligned}
\tag{8.1}\]
Here, \(i\) represents the region, \(t\) represents the time, and \(h\) represents the horizon. The primary focus lies on estimating the coefficients associated with temperature and precipitation for different time horizons\(\color{wongGold}h=\{0,1,...,T_{c}\}\)
To loop over the different crops, we can utilize the map() function. This function enables us to apply the estimate_linear_lp() function to each crop iteratively, facilitating the estimation process.
We can visualize the Impulse Response Functions (IRFs) by plotting the estimated coefficients associated with the weather variables. These coefficients represent the impact of weather on agricultural production and can provide valuable insights into the dynamics of the system. By plotting the IRFs, we can gain a better understanding of the relationship between weather variables and the response of agricultural production over time.
Acevedo, Sebastian, Mico Mrkaic, Natalija Novta, Evgenia Pugacheva, and Petia Topalova. 2020. “The Effects of Weather Shocks on Economic Activity: What Are the Channels of Impact?”Journal of Macroeconomics 65: 103207.
Jordà, Òscar. 2005. “Estimation and Inference of Impulse Responses by Local Projections.”American Economic Review 95 (1): 161–82. https://doi.org/10.1257/0002828053828518.