*data collation and cleaning replace event="8" if event=="8.0" replace obsno="7" if obsno=="00:00" destring obsno, replace destring event, replace replace watsoap="2" if wats=="2.0" replace watsoap="2" if wats=="2`" destring watsoap, replace rename villageid villid recode event 9=. gen eventandbath=event recode eventandbath 8=9 if othertime==1 gen targevent=event recode targevent 1/7=1 8=0 gen ultargevent=event recode ultarg 1=0 2=1 3/5=0 6=1 7=0 8=0 recode ultarg 0=1 if othertime==1 gen action3c=action recode action3c 1=0 2/4=1 5=. recode action3c 1=2 if watso==3 recode action3c 1=2 if watso==4 gen targperson=person recode targpers 1=0 2=1 3=0 4=1 5/6=0 recode ultarg 0=1 if event==3 gen hwsoap= action3c recode hwso 2=1 1=0 *results codebook studyid codebook studyid if interv==0 codebook studyid if interv==1 preserve collapse event villid interv, by (studyid) collapse interv (count) studyid, by(villid) tab interv, sum(studyi) restore replace kidage="" if kidage=="missing" destring kidage, replace preserve collapse kidage interv, by(studyi) tab interv, sum(kid) table interv, c( min kid max kid) restore label var person "person who completed the action" label define person1 1 "man" 2 "target mother/primary care giver" 3 "other adult female" 4"target school aged child" 5"other school aged child (5yo and over)" 6"pre-school child (under 5yo)" label values person person1 tab eventandbath interv tab eventandbath interv, col nof tab hwsoap interv if ultarg==1&targpers==1, col *primary endpoint analysis: xtgee hwsoap interv if ultarg==1&targpers==1, f(bin) l(id) robust i(villid) *subgroup analyses tab hwsoap interv if ultarg==1&person==4, col xtgee hwsoap interv if ultarg==1&person==4, f(bin) l(id) robust i(villid) xtgee hwsoap interv if ultarg==1&person==2, f(bin) l(id) robust i(villid) tab hwsoap interv if ultarg==1&person==2, col tab hwsoap interv if ultarg==1&person==5, col xtgee hwsoap interv if ultarg==1&person==5, f(bin) l(id) robust i(villid) tab hwsoap interv if ultarg==1&person==6, col xtgee hwsoap interv if ultarg==1&person==6, f(bin) l(id) robust i(villid) tab hwsoap interv if ultarg==1&person==1, col xtgee hwsoap interv if ultarg==1&person==1, f(bin) l(id) robust i(villid) xtgee hwsoap interv if ultarg==1, f(bin) l(id) robust i(villid) tab hwsoap interv if ultarg==1, col *breakdown by event type ultarg3c 1=food, 2=feacal contact, 3=bath gen ultarg3c=eventand recode ultarg3c 1=0 2/3=1 4/5=0 6=2 9=3 recode ultarg3c 8=0 7=0 rename ultarg3c ult3c tab hwsoap interv if ultarge==1&targpers==1&ult3c==1, col xtgee hwsoap interv if ultarge==1&targpers==1&ult3c==1, f(bin) l(id) robust i(villid) tab hwsoap interv if ultarge==1&targpers==1&ult3c==2, col xtgee hwsoap interv if ultarge==1&targpers==1&ult3c==2, f(bin) l(id) robust i(villid) tab hwsoap interv if ultarge==1&targpers==1&ult3c==3, col xtgee hwsoap interv if ultarge==1&targpers==1&ult3c==3, f(bin) l(id) robust i(villid) *by other handwash tab hwsoap interv if eventandbath==8&targpers==1, col xtgee hwsoap interv if eventandbath==8&targpers==1, f(bin) l(id) robust i(villid) *breakdown by district tab hwsoap interv if ultarge==1&targpers==1&villid<200, col xtgee hwsoap interv if ultarge==1&targpers==1&villid<200, f(bin) l(id) robust i(villid) tab hwsoap interv if ultarge==1&targpers==1&villid>200, col xtgee hwsoap interv if ultarge==1&targpers==1&villid>200, f(bin) l(id) robust i(villid) gen desari=0 recode desari 0=1 if villid>200 xi:xtlogit hwsoap i.interv*i.desari if ultarge==1&targpers==1, re i(villid) *breadown by village preserve collapse interv hwsoap if ultarg==1&person==4, by(villid) tab villid , sum(hwsoap) mean, if interv==1 tab villid , sum(hwsoap) mean, if interv==0 restore *compare Number of events: preserve collapse interv villid (count) ultargevent if person==4, by(studyid) histogram ult , discr xtpoisson ult interv, re i(villid) xtgee ult interv, f(poiss) l(id) i(villid) robust ttest ul, by( interv) restore preserve collapse interv villid (count) eventand if person==4&eventand==8, by(studyid) histogram event , discr xtpoisson even interv, re i(villid) xtgee eve interv, f(poiss) l(id) i(villid) robust ttest eve, by( interv) restore *sample size update loneway hwsoap villid if ultargev==1& targpers==1 sampsi 0.2 0.35, p(0.8) disp 151*4.36 *SES table gen randnum=uniform() egen randrank=rank(randnum), by(studyid) table interv, c(mean hhsize sd hhsize), if randrank==1 tab caste interv if randrank==1 tab caste interv if randrank==1, nofreq col tab fatheredu interv if randrank==1, nofreq col tab fatheredu interv if randrank==1 tab motheredu interv if randrank==1, nofreq col tab motheredu interv if randrank==1, tab current interv if randrank==1, tab current interv if randrank==1, col tab motorb interv if randrank==1, col tab houset interv if randrank==1, col nof recode hhsizekids 77=7 table interv, c(mean hhsizek sd hhsizek), if randrank==1 gen drinkwat2=drinkwat recode drinkwat2 1/2=1 7=2 tab drinkwat2 inter if randrank==1 tab hhsan interv if randrank==1&latrine<2, col nof *adjusted for water supply xtgee hwsoap interv i.waterloc if ultarg==1&targpers==1&waterloc!=0, f(bin) l(id) robust i(villid) xtgee hwsoap interv i.waterloc if ultarg==1&person==4&waterloc!=0, f(bin) l(id) robust i(villid) *SES comparison between desari and bibhutipur gen randnum=uniform() egen randrank=rank(randnum), by(studyid) table blockid, c(mean hhsize sd hhsize), if randrank==1 table blockid, c(mean hhsizekid sd hhsizekid), if randrank==1 tab caste blockid if randrank==1 tab caste blockid if randrank==1, nofreq col tab fatheredu blockid if randrank==1, nofreq col tab fatheredu blockid if randrank==1 tab motheredu blockid if randrank==1, nofreq col tab motheredu blockid if randrank==1, tab current blockid if randrank==1, tab current blockid if randrank==1, col tab motorb blockid if randrank==1, col , col nof recode hhsizekids 77=7 table blockid, c(mean hhsizek sd hhsizek), if randrank==1 gen drinkwat2=drinkwat recode drinkwat2 1/2=1 7=2 tab drinkwat2 blockid if randrank==1, col nof tab hhsan blockid if randrank==1&latrine<2, col nof xtgee hhsizekid i.blockid if randrank==1, f(gauss) l(id) tab caste blockid if randran==1 tab fatheredu blockid if randran==1 ologit fatheredu i.blockid if randrank==1, cluster(villid) ologit caste i.blockid if randrank==1, cluster(villid) ologit motheredu i.blockid , cluster(villid) tab motheredu blockid if randran==1, col nof ologit housety i.blockid if randrank==1, cluster(villid) logit current i.blockid if randran==1, cluster(villid) logit motor i.blockid if randran==1, cluster(villid) ologit waterloc i.blockid if randr==1, cluster(villid) tab waterloc blockid if randrank==1&waterloc!=0, col nof tab hhsan blockid if randrank==1&latrine<2 ologit hhsan i.blockid if randr==1, cluster(villid) *iv regression for CACE recode intac .=1 if interv==1 recode intac .=0 if interv==0 ivregress 2sls hwsoap (intact= interv) if ultarg==1&targpers==1, vce(cluster villid) ivregress 2sls hwsoap (intact= interv) i.blockid i.waterloc if ultarg==1&targpers==1, vce(cluster villid) gen intexposed=perprot recode intexp 1=0 0=1 if interv==0 ivregress 2sls hwsoap (intexp= interv) if ultarg==1&targpers==1, vce(cluster villid)