Block 2: Civilian victimization: the data
Week 5 · Measurement I · Imai §3.1–3.2 · about 4 min
NoteHow this works
Run each cell with Run Code, look at the output, then answer the question at the end of the block. Every cell is editable; Start Over resets it. Errors are information: read them.
Survey of 2,754 men in 204 villages in Afghanistan (2011). Key variables: age, educ.years, income (a category), violent.exp.ISAF and violent.exp.taliban (harmed by ISAF / by the Taliban, 0/1).
1. Load and describe
What is one row?
2. Missing data
is.na() is TRUE where a value is missing. table() silently drops missing values, so count them explicitly.
3. Who reports harm?
na.rm = TRUE tells mean() to ignore missing values.
Conclusion: What share of respondents reports harm from ISAF, and from the Taliban?
Among those who answered: 37.5% for ISAF and 32.9% for the Taliban (nonresponse excluded with
na.rm = TRUE). 154 respondents (5.6%) are missing on income: always ask how many values are missing, and why.