程序代写 Assignment 5: Empirical Assignment (20%)

Assignment 5: Empirical Assignment (20%)
In this assignment, you will provide a quick but defensible answer to two questions that are of importance to development economics: do droughts lead to violence in India, and is this effect bigger in more religiously fractionalized districts? This assignment draws heavily on the methods I teach in the “How to” sections of the module. It consists of ten questions. The answer to each of these questions is a number.
You will learn:
• New techniques in Stata, such as how to work with spatial data.

Copyright By PowCoder代写 加微信 powcoder

• How to independently improve your empirical skills when faced with a new task.
• How to do well on the coding test for a JPAL-type interview.
Additional instructions:
Your submission will consist of a single pdf. The first page of the pdf will consist of your student number and your numerical answers to the questions asked. The remainder of the pdf will be a log file demonstrating that you were able to produce these answers yourself in Stata, or that you at least made a good faith attempt to do so even if you got stuck or got the wrong answer.
Begin by downloading the five data sources you will need. The first is data on violence. I have posted it here:
https://warwick.ac.uk/fac/soc/economics/staff/jefenske/South-Asia_2010-2021_Jul09.xlsx
Originally, I wanted you to start by signing up for an account with the website https://acleddata.com, get an API key, and download the Curated South Asia data from this link:
https://acleddata.com/download/22704/
But they update the file so regularly that every student would be working with a different file. This can be a real problem when working with data, and it can make replication more difficult. So: in the future, keep track of the date on which you download data.
The second thing you will need is data on rainfall. Download the University of Delaware temperature data linked here:
http://climate.geog.udel.edu/~climate/html_pages/Global2017/precip_2017.tar.gz 17

After I first made this assignment, that website went down. So, if it is still down when you are completing this assignment, use this link as an alternative:
https://warwick.ac.uk/fac/soc/economics/staff/jefenske/precip_2017.zip
This too can be an issue when working with data. It is often better to download something you think you can use later, rather than expecting it to still be online in the future.
The third thing you’ll need is data on religion. Download all the data from Schedule C1 of the Indian Census, which can be found here:
https://censusindia.gov.in/2011census/C-01.html
The fourth thing you’ll need is data on district locations. Download shapefiles for Indian districts, available here:
https://biogeo.ucdavis.edu/data/gadm3.6/shp/gadm36_IND_shp.zip
The fifth thing you will need is the actual coordinates for district centroids. Normally, you’d have to compute these yourself in ArcMAP. But I want you to be able to do this whole assignment in Stata. So, I’ve computed the coordinates myself and put them here:
https://warwick.ac.uk/fac/soc/economics/staff/jefenske/teaching/ec982coordinates.csv
Now, clean all the datasets. Start with the conflict data. Keep only events taking place in “India.” Drop any events that do not look like violence – that is, drop events whose SUB_EVENT_TYPE is any of the following: Agreement, Non-violent transfer of territory, Peaceful protest.
Code a rough proxy for “left wing extremism.” Make this a dummy that is equal to 1 if the NOTES variable contains either i) the n-gram “naxal”, ii) the n-gram “maoist”, or iii) both the n-grams “left” and “wing.” Note that these criteria should not be case sensitive.
• Question 1: How many instances of left-wing extremism are there in this subset of the data?
Collapse the data so that it is at the district-by-year level. That is, for each unique combination of state, district, and year, count the number of violent events, fatalities, and instances of left- wing extremism.
This will be more work than you’re expecting. You will eventually use the districts in gadm36_IND_2.shp as the base set of polygons when running panel regressions. But there are many states with alternative names, districts with alternative names, and districts that have been split over time. I trust you can figure out how to harmonize the state names yourself, but for

harmonizing districts, I have done the hard work for you after a couple hours on Wikipedia. You must do the following:
drop the event if ADMIN2 is missing or blank
rename the district “West” if the district is in Delhi
rename the district “Nellore” if the district name is ” ” rename the district “Y.S.R.” if the district name is “YSR District”
rename the district ” ” if the district name is ” ”
rename the district “Lower Subansiri” if the district name is “Kamle”
rename the district “West Siang” if the district name is “Lower Siang”
rename the district “West Siang” if the district name is ” ”
rename the district “Dhubri” if the district name is “South Salmara-Mankachar” rename the district “Jorhat” if the district name is “Majuli”
rename the district ” ” if the district name is “West ” rename the district “Nagaon” if the district name is “Hojai”
rename the district “Sivasagar” if the district name is “Charaideo”
rename the district “Sonitpur” if the district name is “Biswanath”
rename the district ” ” if the district name is ” ” rename the district “Chandigarh” if the district name is “Chandigarh”
rename the district “Kabeerdham” if the district name is “Kabirdham”
rename the district “Koriya” if the district name is “Korea”
rename the district ” Kanker” if the district name is “Kanker”
rename the district ” ” if the district name is “Chhotaudepur”
rename the district “Dahod” if the district name is “Dohad”
rename the district “Bhiwani” if the district name is ” ”
rename the district “Gurgaon” if the district name is “Gurugram”
rename the district “Mewat” if the district name is “Nuh”
rename the district “Lahul & Spiti” if the district name is “Lahul and Spiti”
rename the district “Badgam” if the district name is “Budgam”
rename the district “Bandipore” if the district name is “Bandipora”
rename the district “Kargil” if the district name is “Kargil”
rename the district “Leh (Ladakh)” if the district name is “Leh”
rename the district “Leh (Ladakh)” if the district name is “Leh”
rename the district “Shupiyan” if the district name is “Shopian”
rename the district “Kodarma” if the district name is “Koderma”
rename the district ” ” if the district name is “West Singhbhum” rename the district ” ” if the district name is “East Singhbhum” rename the district “Sahibganj” if the district name is “Sahebganj”
rename the district “Saraikela-kharsawan” if the district name is “Saraikela-Kharsawan” rename the district “Bagalkot” if the district name is “Bagalkote”
rename the district “Bangalore” if the district name is “Bengaluru Urban”
rename the district “Bangalore Rural” if the district name is “Bengaluru Rural” rename the district “Belgaum” if the district name is “Belagavi”
rename the district “Bellary” if the district name is “Ballari”

rename the district “Bijapur” if the district name is “Vijayapura”
rename the district “Chamrajnagar” if the district name is “Chamarajanagar”
rename the district “Chikballapura” if the district name is “Chikkaballapura”
rename the district “Gulbarga” if the district name is “Kalaburagi”
rename the district “Mysore” if the district name is “Mysuru”
rename the district “Shimoga” if the district name is “Shivamogga”
rename the district “Tumkur” if the district name is “Tumakuru”
rename the district “East Nimar” if the district name is “Khandwa”
rename the district “Narsimhapur” if the district name is “Narsinghpur”
rename the district “Tikamgarh” if the district name is “Niwari”
rename the district “West Nimar” if the district name is “Khargone”
rename the district “Ahmadnagar” if the district name is “Ahmednagar”
rename the district “Bid” if the district name is “Beed”
rename the district “Buldana” if the district name is “Buldhana”
rename the district “Garhchiroli” if the district name is “Gadchiroli”
rename the district “Gondiya” if the district name is “Gondia”
rename the district “Raigarh” if the district name is “Raigad”
rename the district “Chandel” if the district name is “Tengnoupal”
rename the district “Churachandpur” if the district name is “Pherzawl”
rename the district “Imphal East” if the district name is “Jiribam”
rename the district “Senapati” if the district name is “Kangpokpi”
rename the district “Tamenglong” if the district name is “Noney”
rename the district “Thoubal” if the district name is “Kakching”
rename the district “Ukhrul” if the district name is “Kamjong”
rename the district “Jaintia Hills” if the district name is “East Jaintia Hills”
rename the district “Jaintia Hills” if the district name is “West Jaintia Hills”
rename the district “Lawangtlai” if the district name is “Lawngtlai”
rename the district “Bauda” if the district name is “Boudh”
rename the district “Debagarh” if the district name is “Deogarh”
rename the district “Nabarangapur” if the district name is “Nabarangpur”
rename the district “Firozpur” if the district name is “Ferozepore”
rename the district “Muktsar” if the district name is ” Sahib”
rename the district ” Singh Nagar” if the district name is “SAS Nagar” rename the district “Chittaurgarh” if the district name is “Chittorgarh”
rename the district “Dhaulpur” if the district name is “Dholpur”
rename the district “Jalor” if the district name is “Jalore”
rename the district “Jhunjhunun” if the district name is “Jhunjhunu”
rename the district “Kancheepuram” if the district name is “Chengalpattu”
rename the district “Nagappattinam” if the district name is “Nagapattinam”
rename the district “Thoothukkudi” if the district name is “Thoothukudi”
rename the district “Tirunelveli” if the district name is “Tenkasi”
rename the district “Tiruppur” if the district name is “Tirupattur”
rename the district “Vellore” if the district name is “Ranipet”
rename the district “Viluppuram” if the district name is “Kallakurichi”

rename the district “Virudunagar” if the district name is “Virudhunagar”
rename the district “Adilabad” if the district name is ” Asifabad” rename the district “Adilabad” if the district name is “Mancherial”
rename the district “Adilabad” if the district name is “Nirmal”
rename the district “Karimnagar” if the district name is “Jagtial”
rename the district “Karimnagar” if the district name is ” ”
rename the district “Khammam” if the district name is ” ” rename the district “Mahbubnagar” if the district name is ” ” rename the district “Mahbubnagar” if the district name is “Mahabubnagar”
rename the district “Mahbubnagar” if the district name is “Nagarkurnool”
rename the district “Mahbubnagar” if the district name is “Narayanpet”
rename the district “Mahbubnagar” if the district name is “Wanaparthy”
rename the district “Medak” if the district name is “Sangareddy”
rename the district “Medak” if the district name is “Siddipet”
rename the district “Nalgonda” if the district name is “Suryapet”
rename the district “Nalgonda” if the district name is ” ”
rename the district “Nizamabad” if the district name is “Kamareddy”
rename the district ” ” if the district name is “Rangareddy”
rename the district ” ” if the district name is “Medchal-Malkajgiri” rename the district ” ” if the district name is “Vikarabad”
rename the district “Warangal” if the district name is “Jangaon”
rename the district “Warangal” if the district name is ” ” rename the district “Warangal” if the district name is “Mulugu”
rename the district “Warangal” if the district name is “Mahabubabad”
rename the district “Warangal” if the district name is “Warangal Rural”
rename the district “Warangal” if the district name is “Warangal Urban”
rename the district “Unokoti” if the district name is “Unakoti”
rename the district “West Tripura” if the district name is “Sepahijala”
rename the district “Allahabad” if the district name is “Prayagraj”
rename the district “Faizabad” if the district name is “Ayodhya”
rename the district “Kushinagar” if the district name is ” ”
rename the district ” ” if the district name is “Kheri”
rename the district ” ” if the district name is “Bhadohi”
rename the district “Garhwal” if the district name is ” ”
rename the district “Hardwar” if the district name is “Haridwar”
rename the district “Barddhaman” if the district name is ” ” rename the district “Barddhaman” if the district name is ” ”
rename the district “Darjiling” if the district name is “Darjeeling”
rename the district “Darjiling” if the district name is “Kalimpong”
rename the district “Haora” if the district name is “Howrah”
rename the district “Hugli” if the district name is “Hooghly”
rename the district ” ” if the district name is ” ”
rename the district ” ” if the district name is ” ” rename the district ” ” if the district name is “Jhargram”

rename the district “Puruliya” if the district name is “Purulia”
Once you have renamed states and districts and then collapsed the data to the state-by-district- by-year level, save this file.
Next, we’ll clean the list of districts. Open gadm36_IND_2.shp. Merge it to the coordinates saved in ec982coordinates.csv. Expand the data and create a panel such that each district appears 6 times, once for each of the years 2016, 2017, 2018, 2019, 2020, and 2021. Merge this balanced panel to the file you saved earlier on violence. This merge should be unique by state, district, and year. With the instructions I’ve given you, every observation in the collapsed violence data should have a match in this base panel.
• Question 2: What is the mean number of left-wing extremism events across all observations in the panel?
Next, clean the weather data. Open the file precip.2016. You will notice there are columns for longitude, latitude, monthly rainfall, and total annual rainfall. Now, open all the files from 2016 to 2017, inclusive. Keep the variables that record latitude, longitude, and total annual rainfall. We won’t be using the rest. Append the files together.
• Question 3: What is the average total annual rainfall across all points in these data in 2016?
Now, we need to merge the weather data to the conflict data. Begin by identifying every point in the University of Delaware rainfall data that is within 500 kilometres of a district, treating districts as points as given by the coordinates saved in ec982coordinates.csv.
• Question 4: How many points in the weather data are within 500 km of a district coordinate?
Keeping only the years 2016 and 2017, assign each district an annual rainfall value. Do this by averaging over every point in the University of Delaware rainfall data that is within 500 kilometres of its coordinate in a given year.
• Question 5: What is the standard deviation of rainfall across all districts in the data in 2017?
Finally, clean the data on the religious composition of each district in the 2011 census. For each district, compute the share of the total population that is from the categories Hindu, Muslim, Christian, Sikh, Buddhist, Jain, Other, and Not Stated. Compute a Herfindahl index that measures the religious fractionalization of the district – the probability that two individuals selected at random and with replacement come from different religious categories.

• Question 6: What is the average value of religious fractionalization across districts in these data?
Merge these data to the panel data on conflict. That is, for each district in the GADM data, we want to compute a time-invariant measure of its religious fractionalization. Just like the merge above between the GADM districts and the ACLED districts, this will take some work, because there are many states with alternative names, districts with alternative names, and districts that have been split over time. Again, I trust you’ll figure out how to harmonize the state names yourself, but for harmonizing districts, I have again done the hard work for you after a couple hours on Wikipedia. You must:
use the data from “Nicobars” for the district “Nicobar Islands”
use the data from “North & Middle Andaman” for the district “North and Middle Andaman” use the data from ” ” for the district “Nellore”
use the data from “Tirap” for the district “Longding”
use the data from “Lohit” for the district “Namsai”
use the data from “Kaimur (Bhabua)” for the district “Kaimur”
use the data from “Durg” for the district “Balod”
use the data from “Raipur” for the district ” ”
use the data from “Surguja” for the district “Balrampur”, but note there are two districts named “Balrampur,” and this instruction only applies to one.
use the data from “Durg” for the district “Bemetara”
use the data from ” Dantewada” for the district “Dantewada”
use the data from “Raipur” for the district “Gariaband”
use the data from “Janjgir – Champa” for the district “Janjgir-Champa”
use the data from “Bastar” for the district “Kondagaon”
use the data from “Bilaspur” for the district “Mungeli”
use the data from ” Dantewada” for the district “Sukma”
use the data from “Surguja” for the district “Surajpur”
use the data from “Dadra & ” for the district “Dadra and ”
use the data from ” ” for the district “Aravalli”
use the data from “Ahmadabad” for the district “Botad”
use the data from “Vadodara” for the district ” ”
use the data from “Dohad” for the district “Dahod”
use the data from “Jamnagar” for the district ” ”
use the data from “Junagadh” for the district ” ”
use the data from “Kheda” for the district “Mahisagar”
use the data from “Rajkot” for the district “Morbi”
use the data from “Baramula” for the district “Baramulla”
use the data from “Leh(Ladakh)” for the district “Leh (Ladakh)”
use the data from “Punch” for the district “Poonch”
use the data from “Saraikela-Kharsawan” for the district “Saraikela-kharsawan”
use the data from “Chamarajanagar” for the district “Chamrajnagar”
use the data from “Chikkaballapura” for the district “Chikballapura”

use the data from “Shajapur” for the district “Agar Malwa”
use the data from “Khandwa (East Nimar)” for the district “East Nimar”
use the data from “Khargone (West Nimar)” for the district “West Nimar”
use the data from “Gadchiroli” for the district “Garhchiroli”
use the data from “Mumbai” for the district “Mumbai City”
use the data from “Thane” for the district “Palghar”
use the data from “East ” for the district “North ”
use the data from “Ribhoi” for the district ” ”
use the data from “West ” for the district “South West ”
use the data from “West Khasi Hills” for the district “South West Khasi Hills”
use the data from “Lawngtlai” for the district “Lawangtlai”
use the data from “Baudh” for the district “Bauda”
use the data from “Firozpur” for the district “Fazilka”
use the data from “Gurdaspur” for the district “Pathankot”
use the data from “Nagapattinam” for the district “Nagappattinam”
use the data from “Virudhunagar” for the district “Virudunagar”
use the data from “Rangareddy” for the district ” ”
use the data from “South Tripura” for the district “Gomati”
use the data from “West Tripura” for the district “Khowai”
use the data from “West Tripura” for the district “Sipahijala”
use the data from “North

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com