# To replicate the results in the paper "Green Urbanization" 
# by Jan Eeckhout and Christoph Hedtrich follow the steps below.
# In case of errors/issues please contact us at christoph.hedtrich@nek.uu.se or jan.eeckhout@upf.edu


# Software:
Stata 16, additional packages installed automatically.
R 4.0.5 has been used, additional packages that need to be installed: "readxl", "data.table", "tidyr"

## Steps to replicate the results of the paper:
You need to set the working directory at the beginning of each script (both R and Stata) provided. 
Change it to where you stored the replication folder.

0. Create the subfolders "created_data" and "results"
1. Run the R script "crosswalk.R"
2. Run the R script "merge_data.R" -> this creates the file "/created_data/using_dat.csv" which is used in the main analysis of the paper.
3. Run the Stata script "energy_waste_analysis.do"
4. Run the Stata script "parameters.do"

Alternatively, skip 1. and 2. and just move "using_dat.csv" to the folder "created_data/".

## More info about the raw data sources:
1. Energy data: see Sheet "Background" in "Sub-national-total-final-energy-consumption-statistics_2005-2017.xlsx" for details.
2. Waste Data: see Sheet "DivMetaData" in "UK2009-2010.xlsx" for details.
3. Geography: see "Overview of 2011 TTWAs_V4.pdf" and "Methodology note on 2011 Travel to Work Areas_V4.pdf" for details on the construction of Travel to Work areas. 
4. Economic/Population Data: Details about each dataset "XXX_lapre15.txt" in "XXX_lapre15.html"
