The Dynamic Effects of Weather Shocks on Agricultural Production
Introduction
This ebook is the online supplementary materials for the article titled “The Dynamic Effects of Weather Shocks on Agricultural Production”.
The document is divided in six parts.
- The first part provides the codes for downloading the agricultural production data, weather data, and additional data such as map backgrounds (Chapters 1 Weather Data to 4 Other Data). It concludes with the formatting and presentation of the dataset used in the subsequent parts (Chapters 5 Merging the files and 6 Descriptive Statistics).
- The second part provides the codes for replicating the local projections (Chapters 7 The Dynamic Effects of Weather Shocks, 8 Quadratic Terms, and 9 Time-varying exposure to weather shocks).
- The third part gives the codes for replicating the results of the vector autoregressive model (Chapter 10 From Regional to Aggregate Fluctuations).
- The fourth part provides an analysis to examine the impacts of using quarterly data instead of monthly data in the local projections (Chapters 11 Merging: quarterly data and 13 Quarterly Agricultural Production (LP)).
- The fifth part provides a robustness check when using an alternative dataset for precipitation data, to study the response of agricultural production following a weather shock (Chapter 16 Agricultural Production (LP)) and aggregate fluctuations (Chapter 17 Aggregate Fluctuations).
- The sixth part considers alternative definitions of weather shocks, to account for positive vs. negative surprise shocks (Chapter 18 Agricultural Production: Positive vs. Negative Surprise Shocks (LP)). It also considers removing the last year from the data (Chapter 19 Agricultural Production (LP): without 2015 data).
The following ebook does not provide interpretations of the results. The interpretations are given in the article.
The second, third and fourth parts, where we provide the scripts to run the estimations, can be evaluated without completing the first one, as the final dataset obtained at the end of the first part, dataset_2001_2015.rda
, is provided in the data/output
folder (see below).
Replication Codes
The codes presented in this ebook are available in the R
folder. The functions that are sourced within those R scripts are defined the weatherperu/R
folder (the weatherperu
is our R package that helps us create and document the functions used to perform the analysis). This package does not need to be installed.
- Full version: Replication codes + ebook + data (408Mo):
Full zip archive (412Mo) - Light version: Replication codes only (no data) (31.5Mo):
codes (184ko) - Light version of the datasets:
Zip archive with light datasets (1.2Mo)
The following tree architecture is adopted:
Supplementary-materials
├ ── README.txt
├ ── Replication_book
├ ── R
│ └── data-weather.R
│ └── data-agriculture-calendar.R
│ └── data-agriculture.R
│ └── data-macro.R
│ └── data-other.R
│ └── data-merge.R
│ └── data-desc-stats.R
│ └── local_proj_linear.R
│ └── local_proj_quadratic.R
│ └── local_proj_seasonal.R
│ └── aggregate_fluctuations.R
│ └── robustness-data-merge-quarter.R
│ └── robustness-data-merge-annual.R
│ └── robustness-local_proj_linear_quarter.R
│ └── robustness-local_proj_linear_annual.R
│ └── robustness-local_proj_comparison.R
│ └── robustness-local_proj_linear_chirps.R
│ └── robustness-aggregate_fluctuations_chirps.R
│ └── robustness-local_proj_linear_surprise.R
│ └── robustness-local_proj_until_2014.R
├ ── data
│ └── output
| | └── dataset_2001_2015.rda
│ └── raw
├ ── weatherperu
│ └── R
Replication_book
: folder that contains the codes to produce this ebook.R
: folder that contains the R scripts that allow to create the datasets and estimate the models.data
: folder that contains data (raw data inraw
and processed data onoutput
).weatherperu
: useful functions used in the R codes, made available as an R package (the functions are defined in theR
subfolder).
Note that if you run the codes, the estimation results will be saved in the R/output/
folder.
To be able to reproduce the results from the article, we provide all the R codes. The user is kindly invited to download the raw data themselves.
The codes are divided in three parts. The first part contains the code used to obtain the dataset used in the estimations. The second part contains the codes that allow to estimate the local projections and the results obtained with the vector autoregressive model. The third part explores how are the results from the local projections impacted when using quarterly data instead of monthly data.
Preparing the data
data-weather.R
: Weather data (Chapter 1 Weather Data)data-agriculture-calendar.R
: Agricultural calendars (Section 2.3.2.1 Calendar)data-agriculture.R
: Agricultural production (Chapter 2 Agricultural Data)data-macro.R
: Macroeconomic Data (Chapter 3 Macroeconomic Data)data-other.R
: Natural regions, ENSO (Chapter 4 Other Data)data-merge.R
: Merging the datasets to produce the one used in the local projections estimations (Chapter 5 Merging the files)data-desc_stats.R
: Descriptive statistics (Chapter 6 Descriptive Statistics).
Replication of the estimations
local_proj_linear.R
: The Dynamic Effects of Weather Shocks (Chapter 7 The Dynamic Effects of Weather Shocks)local_proj_quadratic.R
: Quadratic Terms (Chapter 8 Quadratic Terms)local_proj_seasonal.R
: Time-varying exposure to weather shocks (Chapter 9 Time-varying exposure to weather shocks)aggregate_fluctuations.R
: From Regional to Aggregate Fluctuations (Chapter 10 From Regional to Aggregate Fluctuations).
Robustness checks: Data Frequency
robustness-data-merge-quarter.R
: Merging the datasets to produce the one used in the local projections estimations using quarterly data (Chapter 11 Merging: quarterly data)robustness-data-merge-annual.R
: Merging the datasets to produce the one used in the local projections estimations using annual data (Chapter 12 Merging: annual data)robustness-local_proj_linear_quarter.R
: Agricultural production response to a weather shock (using Local Projections) with quarterly data (Chapter 13 Quarterly Agricultural Production (LP))robustness-local_proj_linear_annual.R
: Agricultural production response to a weather shock (using Local Projections) with annual data (Chapter 13 Quarterly Agricultural Production (LP))robustness-local_projections-comparisons.R
: Comparison of agricultural response to a weather shock (using Local Projections) according to the data frequency of the agricultural production.
Robustness checks: CHIRPS Data
robustness-local_proj_linear-chirps.R
: Agricultural production response to a weather shock (using Local Projections) with CHIRPS data (Chapter 16 Agricultural Production (LP))robustness-aggregate_fluctuations-chirps.R
: Aggregate fluctuations using CHIRPS data (Chapter 17 Aggregate Fluctuations).
Robustness Check: Other
robustness-local_proj_linear_surprise.R
: Agricultural production response to a surprise weather shock (using Local Projections) with monthly data (Chapter 18 Agricultural Production: Positive vs. Negative Surprise Shocks (LP)).robustness-local_proj_until_2014.R
: Agricultural production response to a weather shock (using Local Projections) excluding the last year of data (Chapter 19 Agricultural Production (LP): without 2015 data).