# Overview

## General structure

The main (root) folder contains the following folders:

• codes/: contains all Matlab/R codes used as inputs in the main replication codes.

• input/: contains the needed inputs (data and more) used in the main replication codes.

• output/: where all output is stored and processed.

Besides, it also contains the README.html file and the main replication codes (explained next).

## Replicating the results

Replicating the results consist of running a sequence of R and Matlab codes. In what follows, we provide an overview of the sequential workflow of the replication and a brief description of each code. Sections 2 to 4 provide further details.

The sequence of codes are the following:

1. gict_initialize.m: initializes the replication package by exporting some raw data to be further processed in R.
2. gict_data.R: processes and exports data from previous step and produces further inputs for the simulations.
3. gict_replicate.m: runs all simulations sequentially.
4. gict_results.m: processes all the results from the previous step, reproduces several plots, and exports inputs needed for producing the maps in R.
5. gict_maps_and_paper.R: reproduces all the maps of the paper and compiles the gict.tex source (which reproduces the paper in pdf format).

Throughout, several inputs are needed (some from previous papers). We describe them next.

## Inputs

• gict.tex: .tex source of the manuscript.
• input/H0_areal.mat: 180x360 grid with fraction of land per cell.
• input/C.csv: 180x360 grid of the country indices per cell. From Desmet et al. (2018).
• input/desert.csv: 180x360 grid of desert dummies. From Desmet et al. (2018).
• input/l.csv and input/pop1.csv: 180x360 grids of the population level (number of people per cell) in the data for years 2000 and 20011, respectively. From Desmet et al. (2018).
• input/y.csv: 180x360 grid of cell level GDP (in PPP) for 2000 divided by cell population. From Desmet et al. (2018).
• input/Y_A.csv: 180x360 gird of cell level agricultural GDP (in PPP) for 2000 produced by Conte et al. (2021);
• input/ubar.csv: 180x360 grid of subjective utility measure for each country, based on the Cantril ladder (Deaton and Stone, 2013). From Desmet et al. (2018).
• input/trmult_reduced_baseline.mat: matrix of bilateral trade costs across land cells to the power -theta (trade elasticity). From Desmet et al. (2018).
• input/diffmult_reduced.mat: matrix of technology diffusion across cells with positive mass of land. From Conte et al. (2021).
• input/T0.csv and * input/T.mat: 180x360 grid of initial temperatures in 2000 and the evolution of local temperatures throughout the 21st century. From Conte et al. (2021).
• input/ksi.csv: 180x360 grid of downscalling parameters $$\xi(r)$$ estimated in Conte et al. (2021).
• input/GDPPC_PPP_WBDI.csv: data table with country GDP (in PPP) in 2020 from the World Bank Development Indicators.
• input/ne_50m_admin_0_countries.*: files that compose the world’s shapefile (used to render the maps).
• input/ne_10m_lakes.rdata: shapefile of lakes in the world (used to render maps).
• input/gaoi_with_data.rdata: spatial grid in Rdata format. From Conte et al. (2021).
• input/grid_025_clipped_intersected.rdata: spatial grid at .25 x .25 degree clipped and intersected with the country shapes (used to render the maps).
• codes/inversions/gict_functions.R: loads several functions used in the main R replication codes.
• output/figures/graph1.pdf: Figure 3.a from Conte et al. (2021) that is reproduced in the paper.
• gict_bib.bib: source of the bibliographic references cited in the paper.

# Pre-processing data

The codes gict_initialize.m and gict_data.R pre-process the some inputs (after setting the working directory in lines 12 and 39, respectively). In particular, the former exports the raw inputs from Conte et al. (2021) y.csv, l.csv, and Y_A.csv in grid format to be loaded in R (e.g. Y_A_raw.csv).

Then, gict_data.R imports the raw input and corrects the grid cell-level agricultural output where it exceeds total GDP (i.e. it corrects some measurement error from Conte et al. (2021)). In particular, it assigns to those cells the average of the relative agricultural GDP of the neighboring cells of the same country.

Moreover, gict_data.R exports regional specific geographical indexes: 180x360 grids of dummies for cells in a certain region (e.g. input/index_eu26.csv stands for dummies of the countries at the European Union).

# Simulations

gict_replicate.m sequentially runs all of the simulations of the paper (after setting the working directory in line 11). It calls the .m codes for each specific simulation, stored in the codes/ and codes/inversion/ folders. Within the latter, the following codes are called:

• inversion.m: does the inversion for sectoral productivities and amenities as in Desmet et al. (2018) and Conte et al. (2021).
• moving_costs.m: does the inversion for mobility costs and separates amenities from initial utility as in Desmet et al. (2018) and Conte et al. (2021).
• theta_inversion.m: does the inversion for sectoral productivities and amenities as in Desmet et al. (2018) and Conte et al. (2021) for different values of $$\theta$$ (trade elasticity).
• theta_moving_costs.m: does the inversion for mobility costs separates amenities from initial utility as in Desmet et al. (2018) and Conte et al. (2021) for different values of $$\theta$$ (trade elasticity).
• omega_moving_costs.m: does the inversion for mobility costs separates amenities from initial utility as in Desmet et al. (2018) and Conte et al. (2021) for different values of $$\Omega$$ (migration elasticity).

Besides, the main simulation codes (stored in codes/) stand for:1

• *reb/: simulations for each rebating scheme (i.e. noreb = simulation without rebating) for 100 periods and CO2 tax = 40USD/tCO2 starting in 2021. Stores the outputs in the output/ folder.
• *reb_HS/: simulations for each rebating scheme and several CO2 tax values (0 to 65 USD/tCO2) for the hump-shaped (_HS) curves. It runs for 21 periods. Stores the outputs in the output/ folder.
• locreb_HS_theta/: simulations with local rebating of CO2 taxes of different values (0 to 65 USD/tCO2) for the hump-shaped (_HS) curves. It runs for 21 periods for different values of $$\theta$$ (the trade elasticity). Stores the outputs in the output/ folder.
• locreb_HS_omega/: simulations with local rebating of CO2 taxes of different values (0 to 65 USD/tCO2) for the hump-shaped (_HS) curves. It runs for 21 periods for different values of $$\Omega$$ (the migration elasticity). Stores the outputs in the output/ folder.
• *reb*_USA/: simulations with local/no rebating of CO2 taxes adopted in the USA (e.g. noreb_HS_USA = hump-shaped simulations as above but for taxes set in the USA). Stores the outputs in the output/ folder.

Note that gict_replicate.m runs all the simulations sequentially, which makes it a time-consuming task (each individual simulation can take half a day to run on a rather powerfull CPU).

To address that, each simulation folder in codes/ contains also a .sh shell code that can be run individually in high-performance computers (e.g. be submitted as a job in a server-like computer/cluster). By launching each of them individually in such a computer/cluster allows one to reproduce all results in in parallel. Importantly, before that one would need to run all of the codes of the codes/inversion/ folder explained above (e.g. inversion.m).

# Processing the results

The codes gict_results.m and gict_maps_and_paper.R process all of the simulation results and report them as documented in the paper (after setting the working directory in lines 12 and 39, respectively). In particular, gict_results.m:

1. Exports all results in the R grid format to be used as inputs for the maps.
2. Plots the evolution of region-sectoral output over time with/out CO2 taxes for several rebating schemes (like Figure 2).
3. Reproduces the tables with the aggregate/regional effects of CO2 taxes for all rebating schemes (like Table 1).
4. Reproduces the plots of regional effects of CO2 taxes with respect to different tax values (like Figure 4).
5. Calculates and plots the effects of CO2 taxes on emissions and temperature with different rebating schemes (Figures 6 and 18).

Then, gict_maps_and_paper.R:

1. Reproduces the maps of the paper using some of the outputs from gict_results.m.
2. Adjusts the layout of the .tex tables to fit the paper’ layout.
3. Renders the final .pdf using the gict.tex latex source.

# References

• Conte, B., Desmet, K., Nagy, D.K. and Rossi-Hansberg, E., 2021. Local sectoral specialization in a warming world. Journal of Economic Geography, 21(4), pp.493-530.

• Deaton, A. and Stone, A.A., 2013. Two happiness puzzles. American Economic Review, 103(3), pp.591-97.

• Desmet, K., Nagy, D.K. and Rossi-Hansberg, E., 2018. The geography of development. Journal of Political Economy, 126(3), pp.903-983.

1. Note that all simulations whose name does not include _USA stand for exercises where carbon is taxed in the EU.↩︎