Code for the article "Meat taxes in Europe can be designed so as to not overburden low-income consumers", to be published in Nature Food

Authors: David Klenert, Franziska Funke and Mattia Cai

Corresponding author: David Klenert

Last update: 31.8.2023

1. Copy EU HBS data into the respective subfolders in 01-Data. Data on population and VAT rates are already in the respective subfolders. Filenames should be in the format "**_HBS_hh.xlsx", with ** being the country code. The R working directory should be the same folder as the folder where this Readme file is located.

2. In the folder "02-Code-Main", open "meat_main.R" and execute line by line to load, clean and aggregate data. In lines 14/15 select whether 2010 or 2015 data should be analysed.
	Step 1 loads all data
	Step 2 cleans and merges the datasets
	Step 3 fixes two additional problems: (a) all quantities for PL and RO in the 2010 wave are off, so we estimated a correction factor using the 2015 data. (b) for some countries, the aggregate variables HE0112, HQ0112, etc. are not the sum of individual variables. We fix this by recalculating the aggregate variable from the individual variables.
	Step 4 determines quintiles at the country level and saves the intermediate data (one file for all countries and one only for countries with quantity data) in the subfolder 04-intmData.
	Step 5 is the main analysis, which is carried out in a separate file "meat_scenario_analysis.R". See point 3.
	Step 6 outputs the results to an xlsx file (not including confidence intervals).
	Step 7 aggregates the data for plotting.
	Step 8 creates figure 1 and the individual country plots for the suplementary information.

3. The microsimulation is done by executing "meat_scenario_analysis.R" line by line after executing steps 1-4 in "meat_main.R".
	* for each scenario, a file called "results_sc*.csv", where * indicates the scenario (1-5), is written into the folder "05-outputData". These files are later used as an input to Stata to compute the confidence intervals (see step 4). If confidence intervals are not needed, skip to point 5.

4. The confidence intervals are computed using the code in folder "03-Code-ConfInt". 
	* The files "results_sc*.csv" are used as inputs for these calculations. To function properly, this code needs result files with 2010 and 2015 data.
	* Execute the files 01... - 04... one after the other to obtain Excel files containing the absolute burdens and Gini coefficients including confidence intervals for individual countries and for the EU aggregate.

5. If no confidence intervals are needed, skip the previous point and execute the code under step 6 in the file "meat_main.R" (in the folder "02-Code-Main") to output an Excel file with the results.

6. In "meat_main.R" (in the folder "02-Code-Main"), execute the code under step 7 to aggregate the data for plotting.

7. In "meat_main.R" (in the folder "02-Code-Main"), execute the code under step 8 to produce Figure 1 and the country level figures for the Supplementary Information.

8. For Figure 2 (as well as for the corresponding figures in the SI), use the code in folder "06-Figure-2". Before executing the code, copy the "results_sc*.csv files into the respective sufolders in "06-Figure-2".
	