/******************************************************************************* *Title: Tables for Wagner et al. 2018 "The role of price and convenience in use of oral rehydration salts to treat child diarrhea" *Created by: Zachary Wagner *Created on: 8-1-2018 *Last modified on: 12-10-2018 *Last modified by: Zachary Wagner *Purpose: This file creates figures presented in the PLOS Medicine paper *******************************************************************************/ clear all set more off *Set Central Directory cd "~/Dropbox/Uganda ORS/VHT study" *Setting data is location global data “S1_data” *setting folder to store tables global tables "tables" *The Following Files Have Been Run: * "Baseline_Clean.do" * "Baseline_ChildLevel" * "Endline_Clean.do" * "Endline_ChildLevel" * "Variables.do" insheet using "$data", clear names *Table 1: Summary Stats By Treatment Assignment *Diarrhea Prevalence is at the HH Level preserve *Dropping excess copies of same HH ID duplicates drop HH_ID, force sum diarr_prev if treat==0 local cntrl_hh=r(N) local cntrl_mean= round(r(mean), .001) local cntrl_mean_sd= round(r(sd), .001) sum diarr_prev if treat==1 local fd_hh=r(N) local fd_mean= round(r(mean), .001) local fd_mean_sd= round(r(sd), .001) sum diarr_prev if treat==2 local hs_hh=r(N) local hs_mean= round(r(mean), .001) local hs_mean_sd= round(r(sd), .001) sum diarr_prev if treat==3 local vouch_hh=r(N) local vouch_mean= round(r(mean), .001) local vouch_mean_sd= round(r(sd), .001) reg diarr_prev I.treat, cluster(village) local grp2_p=round(el(r(table), 4, 2), .001) local grp3_p=round(el(r(table), 4, 3), .001) local grp4_p=round(el(r(table), 4, 4), .001) reg diarr_prev Ib2.treat, cluster(village) local grp2_3_p=round(el(r(table), 4, 2), .001) reg diarr_prev Ib3.treat, cluster(village) local grp2_4_p=round(el(r(table), 4, 2), .001) matrix tab1 =(`cntrl_mean',`fd_mean', `hs_mean', `vouch_mean') mat rownames tab1= diarr_prev mat colnames tab1= "Cntrl" "Grp2" "Grp3" "Grp4" restore gen na=. *Defining variables to use in table tab edu, gen(edu) tab water, gen(water) tab income, gen(income) *Defining variables to used in Table 1 (separating by continuous and binary) global exog_binary edu1 edu2 edu3 male diar_monthly diarr_prev blood fever water1 water2 water3 water4 global exog_cont ct_age ch_age num_child ors_vil ors_zinc_vil heard_ors_vil ors_free_vil *Number of Cases forvalues i=0/3{ sum qb2 if treat==`i' & qb2==1 local cases_`i'=r(N) } matrix cases = ( `cases_0' , `cases_1' , `cases_2' , `cases_3' ) matrix rownames cases = "Cases" foreach var in $exog_cont{ sum `var' if treat==0 local cntrl_mean= round(r(mean), .001) local cntrl_mean_sd= round(r(sd), .001) sum `var' if treat==1 local fd_mean= round(r(mean), .001) local fd_mean_sd= round(r(sd), .001) sum `var' if treat==2 local hs_mean= round(r(mean), .001) local hs_mean_sd= round(r(sd), .001) sum `var' if treat==3 local vouch_mean= round(r(mean), .001) local vouch_mean_sd= round(r(sd), .001) reg `var' I.treat, cluster(village) local grp2_p=round(el(r(table), 4, 2), .001) local grp3_p=round(el(r(table), 4, 3), .001) local grp4_p=round(el(r(table), 4, 4), .001) reg `var' Ib2.treat, cluster(village) local grp2_3_p=round(el(r(table), 4, 2), .001) reg `var' Ib3.treat, cluster(village) local grp2_4_p=round(el(r(table), 4, 2), .001) matrix `var' =(`cntrl_mean',`fd_mean', `hs_mean', `vouch_mean') mat rownames `var'= `var' mat colnames `var'= "Cntrl" "FD" "HS" "Vouch" matrix tab1= (tab1 \ `var') } foreach var in $exog_binary{ sum `var' if treat==0 local cntrl_mean= round(r(mean), .001) local cntrl_mean_sd= round(r(sd), .001) sum `var' if treat==1 local fd_mean= round(r(mean), .001) local fd_mean_sd= round(r(sd), .001) sum `var' if treat==2 local hs_mean= round(r(mean), .001) local hs_mean_sd= round(r(sd), .001) sum `var' if treat==3 local vouch_mean= round(r(mean), .001) local vouch_mean_sd= round(r(sd), .001) logit `var' I.treat, cluster(village) margins, dydx(1.treat 2.treat 3.treat) local grp2_p=round(el(r(table), 4, 2), .001) local grp3_p=round(el(r(table), 4, 3), .001) local grp4_p=round(el(r(table), 4, 4), .001) logit `var' Ib2.treat, cluster(village) margins, dydx(1.treat) local grp2_3_p=round(el(r(table), 4, 1), .001) logit `var' Ib3.treat, cluster(village) margins, dydx(1.treat) local grp2_4_p=round(el(r(table), 4, 1), .001) matrix `var' =(`cntrl_mean',`fd_mean', `hs_mean', `vouch_mean') mat rownames `var'= `var' mat colnames `var'= "Cntrl" "FD" "HS" "Vouch" matrix tab1= (tab1 \ `var') } mat list tab1, format(%6.3f) *Exporting to Excel putexcel set "$tables/table1.csv", replace putexcel A1 = matrix(tab1),names *Table 2: Effect Sizes from Logistic Regressions use "$data", clear foreach var in ors ors_sameday zinc ors_zinc anti{ global controls ct_age I.edu num_child ch_age I.diar_freq blood fever I.water I.income I.latrine chp_visit_vil `var'_vil I.branch logit `var' I.treat, cluster(village) margins, dydx(1.treat) local N = e(N) local grp2=round(el(r(table), 1, 2), .001) local grp2_se=round(el(r(table), 2, 2), .001) local grp2_p=round(el(r(table), 4, 2), .001) local grp2_rd=(el(r(table), 1, 2)) local grp2_rd_ub=(el(r(table), 6, 2)) local grp2_rd_lb=(el(r(table), 5, 2)) logit `var' Ib2.treat, cluster(village) margins, dydx(1.treat) local grp2_3=round(el(r(table), 1, 1), .001) local grp2_3_se=round(el(r(table), 2, 1), .001) local grp2_3_p=round(el(r(table), 4, 1), .001) local grp2_3_rd=(el(r(table), 1, 1)) local grp2_3_rd_ub=(el(r(table), 6, 1)) local grp2_3_rd_lb=(el(r(table), 5, 1)) logit `var' Ib3.treat, cluster(village) margins, dydx(1.treat) local grp2_4=round(el(r(table), 1, 1), .001) local grp2_4_se=round(el(r(table), 2, 1), .001) local grp2_4_p=round(el(r(table), 4, 1), .001) local grp2_4_rd=(el(r(table), 1, 1)) local grp2_4_rd_ub=(el(r(table), 6, 1)) local grp2_4_rd_lb=(el(r(table), 5, 1)) ***Adding Controls*** logit `var' I.treat $controls, cluster(village) margins, dydx(1.treat) local grp2_rd_adj=(el(r(table), 1, 2)) local grp2_rd_adj_ub=(el(r(table), 6, 2)) local grp2_rd_adj_lb=(el(r(table), 5, 2)) logit `var' Ib2.treat $controls, cluster(village) margins, dydx(1.treat) local grp2_3_rd_adj=(el(r(table), 1, 1)) local grp2_3_rd_adj_ub=(el(r(table), 6, 1)) local grp2_3_rd_adj_lb=(el(r(table), 5, 1)) logit `var' Ib3.treat $controls, cluster(village) margins, dydx(1.treat) local grp2_4_rd_adj=(el(r(table), 1, 1)) local grp2_4_rd_adj_ub=(el(r(table), 6, 1)) local grp2_4_rd_adj_lb=(el(r(table), 5, 1)) matrix `var'_est =( `grp2_rd', . , `grp2_rd_adj' , . , `grp2_3_rd', . , `grp2_3_rd_adj' , . , `grp2_4_rd', . , `grp2_4_rd_adj' , . ) matrix `var'_ci =( `grp2_rd_lb', `grp2_rd_ub' , `grp2_rd_adj_lb', `grp2_rd_adj_ub' , `grp2_3_rd_lb', `grp2_3_rd_ub' , `grp2_3_rd_adj_lb', `grp2_3_rd_adj_ub' , `grp2_4_rd_lb', `grp2_4_rd_ub' , `grp2_4_rd_adj_lb', `grp2_4_rd_adj_ub' ) matrix `var' = (`var'_est \ `var'_ci ) mat rownames `var'= `var'_est `var'_ci mat colnames `var'= "FDvControl" "FDvControl" "FDvControl" "FDvControl" "FDvHS" "FDvHS" "FDvHS" "FDvHS" "FDvVouch" "FDvVouch" "FDvVouch" "FDvVouch" } mat tab2=(ors \ ors_sameday \ zinc \ ors_zinc \ anti ) mat list tab2, format(%6.3f) putexcel set "$tables/table2.csv", replace putexcel A1 = matrix(tab2),names *Table 3: Intermediate outcomes at endline use "$data", clear *These are used for labeling purposes gen se=. label var se "SE" gen pval=. label var pval "PVAL" gen na=. global intermediate free_deliv sale voucher obtained_ors ors_stored_diar obtained_zinc zinc_stored_diar chp_visit visit_chp_home seek_treat seek_non_chp mat tab3= (.,.,.,.) mat rownames tab3= na mat colnames tab3= "Cntrl" "FD" "HS" "Vouch" foreach var in $intermediate{ sum `var' if treat==0 local cntrl_mean= round(r(mean), .001) local cntrl_mean_sd= round(r(sd), .001) sum `var' if treat==1 local fd_mean= round(r(mean), .001) local fd_mean_sd= round(r(sd), .001) sum `var' if treat==2 local hs_mean= round(r(mean), .001) local hs_mean_sd= round(r(sd), .001) sum `var' if treat==3 local vouch_mean= round(r(mean), .001) local vouch_mean_sd= round(r(sd), .001) logit `var' I.treat, cluster(village) margins, dydx(1.treat 2.treat 3.treat) local grp2_p=round(el(r(table), 4, 2), .001) local grp3_p=round(el(r(table), 4, 3), .001) local grp4_p=round(el(r(table), 4, 4), .001) logit `var' Ib2.treat, cluster(village) margins, dydx(1.treat) local grp2_3_p=round(el(r(table), 4, 1), .001) logit `var' Ib3.treat, cluster(village) margins, dydx(1.treat) local grp2_4_p=round(el(r(table), 4, 1), .001) matrix `var' =(`cntrl_mean',`fd_mean', `hs_mean', `vouch_mean' \ . , `grp2_p', `grp3_p', `grp4_p' \ . , . , `grp2_3_p', `grp2_4_p') mat rownames `var'= `var' pval mat colnames `var'= "Cntrl" "FD" "HS" "Vouch" matrix tab3= (tab3 \ `var') } mat list tab3, format(%6.3f) *P-values for this table will be adjusted using the free step-down resampling method to control the False Discovery Rate (FDR) (Anderson, 2012) putexcel set "$tables/table3.csv", replace putexcel A1 = matrix(tab3),names