R for Every Survey Analysis
Outline
Surveys in the developing world
¹According to TA Telcom 2013
Surveys in the developing world
Types of Data and Sources
Census - count everyone
Civil registration and vital statistics (CRVS) - count events (registration, births, deaths)
Surveys - ask subsets about various topics
World Bank (LSMS) - SPSS
UNICEF (MICS) - SPSS
USAID (DHS) - SAS, Stata, SPSS
Afrobarometer - SPSS
Governments - ?
Surveys in the developing world
Surveys in the developing world
Image: Wikipedia
Surveys in the developing world
Images: TCG
Surveys in the developing world
Phones and internet in Africa
Images: Pew 2015
Surveys in the developing world
©2015 Mobile Accord, Inc. All rights reserved
Surveys in the developing world
©2015 Mobile Accord, Inc. All rights reserved
Surveys in the developing world
©2015 Mobile Accord, Inc. All rights reserved
Surveys in the developing world
Shifting to FOSSS
Making Free and Open Source Statistical Software standard:
Side-by-side books and sites help:
Credit: sodahead.com
Shifting to FOSSS
Shifting to FOSSS
Variable Recoding
Creating the variables you need for your analysis
| | | |
| | | |
| | | |
| | | |
|
|
|
|
Variable Recoding
library(foreign)
data <- read.dta("my_stata_file.dta")
...
write.dta(data_final, "my_new_stata_file.dta"))
2. Change variable headings
colnames(df_station_list)[colnames(df_station_list) == 'Var1'] <- 'StationName'
3. Compute and change variable values
data$StationId[data$Station == "Did Not Watch"] = 999999
data$AgeGroup[data$Age >= 15 & data$Age <= 24] <- "15 to 24"
data$AgeGroup2[data$Age >= 15 & data$Age <= 24] <- data$AgeGroup[data$Age >= 15 & data$Age <= 24]
data_merge$PopWeight = data_merge$weight * data_merge$pop
Variable Recoding
Weighting
Making adjustments based on demographic variations in sampling
| | | |
| | | |
| | | |
| | | |
0.72 |
1.52 |
0.88 |
1.45 |
Credit: Evan-Amos - Wikipedia
Weighting
Weighting
1)
2)
3)
Analysis & Reporting
table(data$Gender,exclude=NULL)
table(data$Gender,data$AgeGroup)
2. R STUDIO!
3. RMARKDOWN!
(KNITR/PANDOCS!)
Future areas to focus on