The Dynamic Effects of Weather Shocks on Agricultural Production

Authors
Affiliations

Cédric Crofils

LEDa, Paris-Dauphine & PSL Universities

Ewen Gallic

Aix-Marseille School of Economics, Aix-Marseille Université

Gauthier Vermandel

CMAP, Ecole polytechnique, Institut Polytechnique de Paris

Published

January 29, 2023

Newer Version

The last version is available here: https://egallic.fr/Recherche/weather-peru-v2/

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 three parts. The first part provides the codes for downloading the agricultural production data, weather data, and additional data such as map backgrounds (Chapters 1 to 4). It concludes with the formatting and presentation of the dataset used in the subsequent parts (Chapters 5 and 6). The second part provides the codes for replicating the local projections (Chapters 7, 8, and 9), and the codes for replicating the results of the vector autoregressive model (Chapter 10).The third part provides an analysis to examine the impacts of using quarterly data instead of monthly data in the local projections (Chapters 11 and 12).

Warning

The following ebook does not provide interpretations of the results. The interpretations are given in the article.

Estimation of the models only

The second part, 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.

The following tree architecture is adopted:

Supplementary-materials
├ ── Replication_book
├ ── R
│   └── data-weather.R
│   └── data-agriculture-calendar.R
│   └── data-agriculture.R
│   └── data-macro.R
│   └── data-other.R
│   └── data-merge.R
│   └── data-merge-quarter.R
│   └── data-desc-stats.R
│   └── local_proj_linear.R
│   └── local_proj_linear-quarter.R
│   └── local_proj_quadratic.R
│   └── local_proj_seasonal.R
│   └── VAR.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 in raw and processed data on output).
  • weatherperu: useful functions used in the R codes, made available as an R package (the functions are defined in the R subfolder).
Raw Data

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.

  1. Preparing the data

    • data-weather.R: Weather data (Chapter 1)
    • data-other.R: Natural regions, ENSO (Chapter 4)
    • data-agriculture-calendar.R: Agricultural calendars (Section 2.3.2.1)
    • data-agriculture.R: Agricultural production (Chapter 2)
    • data-macro.R: Macroeconomic Data (Chapter 3)
    • data-merge.R: Merging the datasets to produce the one used in the local projections estimations (Chapter 5)
    • data-desc_stats.R: Descriptive statistics (Chapter 6)
  2. Replication of the estimations

    • local_proj_linear.R: The Dynamic Effects of Weather Shocks (Chapter 7)
    • local_proj_quadratic.R: Quadratic Terms (Chapter 8)
    • local_proj_seasonal.R: Time-varying exposure to weather shocks (Chapter 9)
    • VAR.R: From Regional to Aggregate Fluctuations (Chapter 10)
  3. Robustness checks

    • data-merge-quarter.R: Merging the datasets to produce the one used in the local projections estimations using quarterly data (Chapter 11)
    • local_proj_linear-quarter.R: Local Projections with Quarterly Data (Chapter 12).