Replication code for "The Effects of Fair Trade Certification: Evidence from Coffee Producers in Uganda" (Masuda, 2026)
# Replication Package for: "The Effects of Fair Trade Certification: Evidence from Coffee Producers in Uganda"
(フェアトレード認証の効果:ウガンダのコーヒー生産者における実証分析 )
**Author:** Ren Masuda(真寿田 蓮)
**Date:** January 2026
**Note:** This repository contains the data and replication code for my undergraduate thesis at the Faculty of Economics, The University of Tokyo. The paper was selected as an Outstanding Thesis (特選論文).
## Overview
This repository contains the replication code and documentation for the thesis **"The Effects of Fair Trade Certification: Evidence from Coffee Producers in Uganda"**.
This study investigates the impact of Fair Trade certification on the welfare of smallholder coffee farmers in Uganda, utilizing a unique four-wave panel dataset (2010-2019) constructed from the World Bank's Living Standards Measurement Study - Integrated Surveys on Agriculture (LSMS-ISA).
The analysis employs a **Difference-in-Differences (DID)** strategy augmented by a **Heckman two-step correction** to address endogeneity and self-selection bias.
## 1. Data Availability
The analysis relies on the **Uganda National Panel Survey (UNPS)** data provided by the World Bank. Due to licensing restrictions, the raw data files **cannot be redistributed** in this repository.
To replicate the analysis, you must download the following datasets directly from the World Bank Microdata Library and place them in the `data/` directory.
### Required Datasets & Folder Structure
Please ensure the downloaded data folders are named exactly as follows to match the file paths in the scripts:
* **Wave 2019-2020**: `data/UGA_2019_UNPS_v03_M_STATA14/`
* **Wave 2015-2016**: `data/UGA_2015_UNPS_v02_M_STATA14/`
* **Wave 2011-2012**: `data/UGA_2011_UNPS_v02_M_Stata/`
* **Wave 2010-2011**: `data/not_in_use/UGA_2010_UNPS_v03_M_STATA12/`
> **Note:** The analysis code (`s_01` to `s_02`) reads Stata (`.dta`) files from these specific directories.
## 2. Software Requirements
The analysis was performed using **R**. Th …