Skip to content

Instantly share code, notes, and snippets.

Created March 15, 2013 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5170482 to your computer and use it in GitHub Desktop.
Save anonymous/5170482 to your computer and use it in GitHub Desktop.
Do file to check consistency of figures/statistics presented in Dupas & Robinson (2013) against what appears in the data
***************************************************************************************************
/* Do file to check consistency of figures/statistics presented in Dupas & Robinson (2013) against
what appears in the data */
***************************************************************************************************
clear
set mem 500m
* set directory
gl DRIVE "/Users/katiacovarrubias/Documents/Academic/IHEID/Courses/Advanced Econometrics/Exam/Dupas_data/"
* log file
capture log close
log using "$DRIVE/dupas_consistencycheck.log",replace
* load data and run variable creation from their do file
use "$DRIVE/dataset_savingsAEJ.dta",clear
*********************************************************
*Variable creation from dupas do file
* Active if had more than one bank transaction in first 6 months
gen active=(first6_num_trans_savings>1) if first6_num_trans_savings!=.
* Treatment interacted with works as boda-boda dummy
gen treatment_bg_boda=treatment*bg_boda
* Active bank account interacted with works as boda-boda dummy
gen active_bg_boda=active*bg_boda
* Works as boda-boda and sampled at wave 2
gen bg_boda_wave2=bg_boda & wave2
* Works as male vendor and sampled at wave 2
gen bg_malevendor_wave2=bg_malevendor & wave2
* Works as male vendor and sampled at wave 3
gen bg_malevendor_wave3=bg_malevendor & wave3
* Treatment interacted with works as male vendor
gen treatment_bg_malevendor=treatment*bg_malevendor
* Active bank account interacted with works as male vendor
gen active_bg_malevendor=active*bg_malevendor
* literacy var
gen literate_swahili=1 if bg_kis_read==1 & bg_kis_write==1
replace literate_swahili=0 if bg_kis_read==0 | bg_kis_write==0
*****************************************************************************
* PAGE 166
sum investment
* 353 Ksh
sum investment if investment!=0
* 365 Ksh
sum investment if !(wave1==. & wave2==. & wave3==.)
* 353 Ksh
sum investment if !(wave1==. & wave2==. & wave3==.) & investment !=0
* 365 Ksh
tab bg_loan_bank if !(wave1==. & wave2==. & wave3==.)
* 2.8 percent
tab bg_loan_bank if !(wave1==. & wave2==. & wave3==.) & not_trac==0
* 3.26 percent if only consider individuals that were able to be tracked down.
*****************************************************************************
* page 167
tab per_hard_save if !(wave1==. & wave2==. & wave3==.)
* 85.62% (125 obs)
tab per_hard_save
* 85.71% (126)
*****************************************************************************
* PAGE 168
* explore number of observations in male bicycle taxi drivers (92 OR 96?)
*****************************************************************************
* PAGE 169
g illiterate=literate==0
table bg_gender if inlog==1 , c(mean illiterate)
* 7.5% males; 34.1% females
sum exp_total if inlog==1
display 50/r(mean)
* 28.97%
*****************************************************************************
* PAGE 170
g logrefuse=inlog==0
table not_traced_acco, c(mean inlog mean logref) row
* 28.9% overall
count if per_hard_save!=. & per_invest_choice2!=. & per_somewhat_patient!=. & per_time_consistent!=. & per_hyperbolic!=. & per_pat_now_impat_later!=. & per_maximpat!=.
* 143 obs
*****************************************************************************
* PAGE 173
tab num_dep_sav if (treatment==1 & not_traced_account_opening==0) ,m
* 10 missing obs (6.4%), 72 zeroes (46%)
*****************************************************************************
* PAGE 174
* median deposits for both genders
sum first6_dep_savings if treatment==1 & wave1!=. & wave2!=. & wave3!=. , det
display r(p50) /*0*/
*75th and 90th percentile of total deposits- males
sum first6_dep_savings if treatment==1 & bg_gender==1 & wave1!=. & wave2!=. & wave3!=. , det
display r(p75) /*300*/
display r(p90) /*1200*/
*75th and 90th percentile of total deposits- females
sum first6_dep_savings if treatment==1 & bg_gender==0 & wave1!=. & wave2!=. & wave3!=. , det
display r(p75) /*500*/
display r(p90) /*5000*/
* Mean deposits across gender
table bg_gender if treatment==1 & wave1!=. & wave2!=. & wave3!=. , c(mean first6_dep_savings)
*****************************************************************************
* PAGE 176
tab active if treatment==1
tab active if treatment==1 & filled_log !=. & filled_log !=0
*****************************************************************************
* PAGE 187
* check median of average deposit size
* From D&R do file: Average deposit size is total of all deposits ever made/total number of deposits ever made
gen size_deposit=total_dep_savings/num_dep_savings
sum size_deposit, detail
sum size_deposit if active==1, detail
display r(p50)
* median= 300 Ksh
* for active women:
sum size_deposit if active==1 & bg_gender==0, detail
display r(p50)
* median=588.8889
* this median should be equivalent to 1.6 days of mean expenditures for women in the sample
sum exp_total if active==1 & bg_gender==0, detail
display 588.8889/r(mean) /*2.41 times average daily expenditure for active women*/
display 300/r(mean) /*1.23 times average daily expenditure for active women*/
sum exp_total if bg_gender==0, detail
display 588.8889/r(mean) /*3.25 times average daily expenditure for women*/
display 300/r(mean) /*1.65 times average daily expenditure for women*/
*****************************************************************************
* EXTRA: Check trimming
count if filled_log!=0 & filled_log!=.
list investment* bg_boda bg_malevendor bg_femalevendor if filled_log!=0 & filled_log!=. & (investment!=investment_t5), separator(0)
count if filled_log!=0 & filled_log!=. & (investment!=investment_t5)
* 36 obs (14%)
list revenues* bg_boda bg_malevendor bg_femalevendor if filled_log!=0 & filled_log!=. & (revenues!=revenues_t5), separator(0)
count if filled_log!=0 & filled_log!=. & (revenues!=revenues_t5)
* 46 obs (18.4%)
* it seems that trimming was not on the overall sample, but for each individual's records
*****************************************************************************
log close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment