** Dominican Republic 2013 ** ** HH DEPRIVATIONS ** /* A household is deprived in LIVING STANDARDS if it a. Does not have electricity or Has electricity but neither has a television nor a refrigerator b. Does not use improved drinking water sources (MDG indicator 7.8) c. Does not use improved sanitation (MDG indicator 7.9) d. Uses solid fuel for cooking and heating (non-MDG indicator related to target 7) e. Does not have the finished floor (non-MDG indicator related to Target 7). Weighting: each indicator is weighted by 1/5 A household is poor in Living standards if the sum of weighted deprivations is 1/3 or more. */ clear clear matrix set more off set maxvar 9000 cd "C:\Users\cecilia.calderon\HDRO_MCC\MPI\MPI_new calculations\Dominican 2013_DHS\" use "DRHR61FL.DTA", clear gen wealthi = hv270 gen wealths = hv271/100000 gen weight = hv005/1000000 gen hhmembers_hh = hv009 gen urban = 1 if hv025==1 replace urban = 0 if hv025==2 * ELECTRICITY * gen electricity = hv206 if hv206==0 | hv206==1 * DRINKING WATER * gen water = 1 if hv201==11 | hv201==12 | hv201==21 | hv201==51 | hv201==71 replace water = 0 if hv201==43 | hv201==61 | hv201==62 | hv201==96 replace water=0 if (hv204>=30 & hv204<=500) | ((hv204==998 | hv204==999) & (hv201==13 | hv201==21 | hv201==31 | hv201==41 | hv201==51 | hv201==71)) /* Piped into dwelling | 650 5.67 5.67 11 y Piped to yard/plot | 1,179 10.28 15.95 12 y Tube well or borehole | 159 1.39 17.34 21 y River/dam/lake/ponds/stream/canal/irrig | 183 1.60 18.94 43 n Rainwater | 458 4.00 22.93 51 y Tanker truck | 31 0.27 23.20 61 n Cart with small tank | 629 5.49 28.69 62 n Bottled water | 8,119 70.82 99.51 71 y Other | 55 0.48 99.99 96 n 99 | 1 0.01 100.00 99 */ *** THE REPORT FOR DR 2013 TREATS BOTTLED WATER AS IMPROVED *** * El 78 por ciento de los hogares utilizan agua embotellada para beber y en sólo el 11 por ciento se usa el agua proveniente de la red pública. Estos datos representan un cambio dramático en relación con las cifras respectivas resultantes en ENDESA 2007: 57 y 22 por ciento. ** In DHS 2007 I treat bottled water as not improved BUT 48% (unweighted) [57% weighted] of HHs use bottled water; it should be changed to improved to make it comparable ** * SANITATION * gen sanitation = 0 if hv205==11 | hv205==22 replace sanitation = 1 if hv205==23 | hv205==31 | hv205==96 replace sanitation = 0 if hv225==1 /*shared*/ /* Flush to piped sewer system | 7,285 63.55 63.55 11 y Pit latrine with slab | 3,183 27.77 91.31 22 y Pit latrine without slab/open pit | 398 3.47 94.78 23 n No facility/bush/field | 592 5.16 99.95 31 n Other | 3 0.03 99.97 96 n 99 | 3 0.03 100.00 99 */ * COOKING FUEL * gen cookingfuel = 0 if (hv226>=6 & hv226<=11) | hv226==95 | hv226==96 replace cookingfuel = 1 if hv226>=1 & hv226<=5 * FLOOR * gen floor = 1 if hv213==21 | hv213==22 | hv213==31 | hv213==32 | hv213==33 | hv213==34 | hv213==35 replace floor = 0 if hv213==11 | hv213==12 | hv213==96 * ASSETS * /* Household is not deprived in assets if it owns at least one of the assets for access to information (phone (mobile or fixed), radio, TV) AND either one asset for easy mobility (bicycle, motorbike, motorboat, car, truck or animal wheel cart) OR one asset for livelihood (refrigerator, agricultural land or livestock (at least one cattle or at least one horse or at least two goats or at least two sheep, or at least 10 chicken) */ foreach var in hv207 hv208 hv221 hv210 hv211 hv209 hv212 hv243a hv243d hv243c hv244 sh51e { replace `var'=. if `var'==9 } foreach var in hv246a hv246b hv246c hv246d hv246e hv246f hv246h { replace `var'=. if `var'>=98 } * Information * gen phone = 0 if sh51e==0 replace phone = 1 if sh51e==1 /* cell phone or landline */ gen radio = 0 if hv207==0 replace radio = 1 if hv207==1 gen tv = 0 if hv208==0 replace tv = 1 if hv208==1 * Mobility * gen bicycle = 0 if hv210==0 replace bicycle = 1 if hv210==1 gen motorcycle = 0 if hv211==0 replace motorcycle = 1 if hv211==1 gen motorboat = . gen car_truck = 0 if hv212==0 replace car_truck = 1 if hv212==1 gen animal_cart = . * Livelihood * gen refrigerator = 0 if hv209==0 replace refrigerator = 1 if hv209==1 gen land = 0 if hv244==0 replace land = 1 if hv244==1 gen cattle = 0 if hv246b==0 & hv246a==0 replace cattle = 1 if (hv246b>0 & hv246b<=95) | (hv246a>0 & hv246a<=95) gen horses = 0 if hv246c==0 replace horses = 1 if (hv246c>0 & hv246c<=95) gen goats = 0 if hv246h<2 /* sheeps and goats together */ replace goats = 1 if (hv246h>=2 & hv246h<=95) gen sheeps = . gen chicken = 0 if hv246f<10 replace chicken = 1 if (hv246f>=10 & hv246f<=95) egen information_miss = rowmiss(phone radio tv) egen mobility_miss = rowmiss(bicycle motorcycle car_truck) egen livelihood_miss = rowmiss(refrigerator land cattle horses goats chicken) gen information_depriv = . if information_miss==2 | information_miss==3 replace information_depriv = 0 if phone==1 | radio==1 | tv==1 replace information_depriv = 1 if phone==0 & radio==0 & tv==0 gen mobility_depriv = . if mobility_miss==2 | mobility_miss==3 replace mobility_depriv = 0 if bicycle==1 | motorcycle==1 | car_truck==1 replace mobility_depriv = 1 if bicycle==0 & motorcycle==0 & car_truck==0 gen livelihood_depriv = . if livelihood_miss==4 | livelihood_miss==5 | livelihood_miss==6 replace livelihood_depriv = 0 if refrigerator== 1 | land==1 | cattle==1 | horses==1 | goats==1 | chicken==1 replace livelihood_depriv = 1 if refrigerator==0 & land==0 & cattle==0 & horses==0 & goats==0 & chicken==0 gen asset_depriv = . if information_depriv==. | (information_depriv==1 & mobility_depriv==0 & livelihood_depriv==.) | (information_depriv==1 & mobility_depriv==. & livelihood_depriv==0) replace asset_depriv = 0 if information_depriv==0 & (mobility_depriv==0 | livelihood_depriv==0) replace asset_depriv = 1 if information_depriv==1 | (information_depriv==0 & mobility_depriv==1 & livelihood_depriv==1) foreach var in sanitation water floor cookingfuel electricity { gen `var'_depriv=1 if `var'==0 replace `var'_depriv=0 if `var'==1 } egen depriv = rsum(electricity_depriv sanitation_depriv water_depriv floor_depriv cookingfuel_depriv asset_depriv) replace depriv = . if electricity_depriv==. & sanitation_depriv==. & water_depriv==. & floor_depriv==. & cookingfuel_depriv==. & asset_depriv==. gen ls_sample=1 if electricity_depriv<. & sanitation_depriv<. & water_depriv<. & floor_depriv<. & cookingfuel_depriv<. & asset_depriv<. egen livings_miss = rowmiss(electricity_depriv sanitation_depriv water_depriv floor_depriv cookingfuel_depriv asset_depriv) keep if hv015==1 /* completed HH interview */ sort hv001 hv002 keep wealthi wealths weight hhmembers_hh urban electricity electricity_depriv water sanitation cookingfuel floor sanitation_depriv water_depriv floor_depriv cookingfuel_depriv depriv ls_sample livings_miss hv001 hv002 phone radio tv bicycle motorcycle car_truck motorboat animal_cart refrigerator land cattle horses goats sheeps chicken information_miss mobility_miss livelihood_miss information_depriv mobility_depriv livelihood_depriv asset_depriv save "HH_MPI2_MCC.dta", replace * BIRTHs' QUESTIONNAIRE TO CALCULATE WHEN THE DEATH OF A CHILD HAPPENED * use "DRBR61FL.DTA", clear gen usual_res=(v135==1) drop if usual_res==0 gen date_death = b3+b7 gen mdead_from_survey = v008-date_death gen ydead_from_survey = mdead_from_survey/12 gen y = ydead_from_survey if b7<=60 label var ydead_from_survey "# years from survey that a child died" label var y "# years from survey that a child<=5y died" gen b5r=0 if b5==1 replace b5r=1 if b5==0 egen child_died=sum(b5r), by(v001 v002 v003) egen child_died2=rsum(v206 v207) compare child_died child_died2 * they are identical * egen child_died5=sum(b5r) if ydead_from_survey<=5, by(v001 v002 v003) * only deaths in the past 5 years * replace child_died5=0 if child_died5==. & child_died>=0 & child_died<. replace child_died5=. if b5r==1 & ydead_from_survey==. sort v001 v002 v003 ydead_from_survey bys v001 v002 v003: gen uno=1 if _n==1 keep if uno==1 drop uno tab child_died child_died5,m egen child_diedhh=sum(child_died), by(v001 v002) *egen child_died2hh=sum(child_died2), by(v001 v002) egen child_died5hh=sum(child_died5), by(v001 v002) gen uno=1 egen nwomen_birth_15_49=sum(uno), by(v001 v002) drop uno bys v001 v002: gen uno=1 if _n==1 keep if uno==1 drop uno tab child_diedhh child_died5hh,m drop child_died2 child_died keep child_died5 v001 v002 nwomen_birth_15_49 child_died5hh child_diedhh ren v001 hv001 ren v002 hv002 sort hv001 hv002 save "child_death_MPI2_MCC.dta", replace * WOMEN'S QUESTIONNAIRE (15-49 y) * use "DRIR61FL.DTA", clear gen usual_res=(v135==1) /* keep only usual residents, drop visitors */ drop if usual_res==0 egen children_died=rsum(v206 v207) egen children_diedhh=sum(children_died), by(v001 v002) gen uno=1 egen nwomen15_49=sum(uno), by(v001 v002) drop uno sort v001 v002 v003 bys v001 v002: gen uno=1 if _n==1 keep if uno==1 drop uno ren v001 hv001 ren v002 hv002 ren v003 hv003 keep hv001 hv002 children_diedhh nwomen15_49 sort hv001 hv002 save "DRIR61FL_MCC.dta", replace * INDIVIDUALS' QUESTIONNAIRE * use "DRPR61FL.DTA", clear sort hv001 hv002 merge hv001 hv002 using "DRIR61FL_MCC.dta" tab _merge ren _merge merge_women sort hv001 hv002 merge hv001 hv002 using "HH_MPI2_MCC.dta" tab _merge drop _merge sort hv001 hv002 merge hv001 hv002 using "child_death_MPI2_MCC.dta" tab _merge ren _merge merge_births replace child_died5hh=0 if children_diedhh==0 & child_died5hh==. replace child_diedhh=0 if children_diedhh==0 & child_diedhh==. gen age = hv105 if hv105<98 gen sex = 1 if hv104==1 replace sex = 0 if hv104==2 egen hh=group(hv001 hv002) gen uno=1 egen hhmembers=sum(uno), by(hh) compare hhmembers hv009 drop hhmembers uno gen usual_res=(hv102==1) drop if usual_res==0 gen uno=1 egen hhmembers=sum(uno), by(hh) label var hhmembers "Number of HH members (only usual residents, excludes visitors)" label var hhmembers_hh "Number of HH members (usual residents + visitors)" drop uno compress sort hv001 hv002 hvidx save "Dominican Republic_MPI2_2013.dta", replace * MPI CALCULATION * *** A- EDUCATION DIMENSION *** /* For the indicator on years of education, if we observe at least one member with five or more years of education then, regardless of the number of other members with missing data, we classify the household as non-deprived. If more than 1/3 of the household members have missing information on years of education, and the people for which we observe the years of education have less than five years, the household is given a missing value in this indicator. If we have information of 2/3 (or more) of household members, and these report less than five years of education, the household will be classified as deprived. For the school attendance indicator, if all school-aged children in a household have missing information in enrolment, that value is considered missing. As long as we have information for one of the children in the household, the household will be classified as non-deprived or deprived depending on whether that child is reported to be attending school or not. */ * http://stats.uis.unesco.org/unesco/TableViewer/tableView.aspx?ReportId=163 * Entrance age of primary: 6y * Duration of primary: 6y * Entrance age of lower secondary: 12y * Durantion lower secondary: 2y * Entrance age high secondary: 14y * Duration high secondary: 4y /* reviewed July 1st 2013 */ ** 1- DEPRIVED IN EDUCATION ** gen yschooling = 0 if hv106==0 | (hv106==1 & hv107==0) replace yschooling =1 if hv106==1 & hv107==1 replace yschooling =2 if hv106==1 & hv107==2 replace yschooling =3 if hv106==1 & hv107==3 replace yschooling =4 if hv106==1 & hv107==4 replace yschooling =5 if hv106==1 & hv107==5 replace yschooling =6 if hv106==1 & hv107==6 replace yschooling =7 if hv106==1 & hv107==7 replace yschooling =8 if hv106==1 & hv107==8 replace yschooling =9 if hv106==2 & hv107==1 replace yschooling =10 if hv106==2 & hv107==2 replace yschooling =11 if hv106==2 & hv107==3 replace yschooling =12 if hv106==2 & hv107==4 replace yschooling =13 if hv106==3 & hv107==1 replace yschooling =14 if hv106==3 & hv107==2 replace yschooling =15 if hv106==3 & hv107==3 replace yschooling =16 if hv106==3 & hv107==4 replace yschooling =17 if hv106==3 & hv107==5 replace yschooling =18 if hv106==3 & hv107==6 replace yschooling =19 if hv106==3 & hv107==7 replace yschooling =20 if hv106==3 & hv107==8 replace yschooling =21 if hv106==3 & hv107==9 replace yschooling =22 if hv106==3 & hv107==10 replace yschooling =23 if hv106==3 & hv107==11 replace yschooling =24 if hv106==3 & hv107==12 replace yschooling =25 if hv106==3 & hv107==13 replace yschooling =8 if hv106==2 & hv107==0 replace yschooling =12 if hv106==3 & hv107==0 replace yschooling=. if age<5 gen uno14=1 if age>=12 & age<. /* Number of HH members 12y or older */ bys hhid: egen hhmember14 = sum(uno14) ** 1- DEPRIVED IN EDUCATION ** gen yschoolingi=0 if yschooling<6 & age>=12 & age<. replace yschoolingi=1 if yschooling>=6 & yschooling<. replace yschoolingi=1 if yschooling==. & ((hv106==2 | hv106==3) & (hv107==98 | hv107==99)) gen schooling_missing = 1 if (((hv106==8 | hv106==9) & hv107==.) | (hv106==1 & (hv107==98 | hv107==99))) & age>=12 & age<. egen schooling_missinghh=sum(schooling_missing), by(hhid) egen yeduchh=sum(yschoolingi), by(hhid) /* assumes that a member has <6 y schooling when there is missing info on that member's schooling */ replace yeduchh=. if schooling_missinghh==hhmember14 * DEPRIVED IN EDUCATION INDICATOR * gen educ_depriv=1 if yeduchh==0 replace educ_depriv=0 if yeduchh>=1 & yeduchh<. replace educ_depriv=. if yeduchh ==0 & schooling_missinghh>0 & schooling_missinghh>(1/3*hhmember14) ** 2- DEPRIVED IN SCHOOL ATTENDANCE 7-14Y (entrance age is 6 but we allow for 1 year of late enrollment) ** gen attendance_missing=1 if hv121==9 & age>=7 & age<=14 gen child_7_14=1 if age>=7 & age<=14 egen attendance_missinghh=sum(attendance_missing), by(hhid) egen child_7_14hh=sum(child_7_14), by(hhid) gen child_6_14=1 if age>=6 & age<=14 egen child_6_14hh=sum(child_6_14), by(hhid) gen attendance_missing_final = 1 if attendance_missinghh==child_7_14hh & child_7_14hh>0 & attendance_missing==1 & child_7_14==1 egen attendance_missing_finalhh = sum(attendance_missing_final), by(hhid) gen child_noattend=1 if hv121==0 & age>=7 & age<=14 replace child_noattend=0 if hv121==2 & age>=7 & age<=14 * DEPRIVED IN SCHOOL ATTENDANCE 7-14Y * egen child_noattendhh=sum(child_noattend), by(hhid) replace child_noattendhh=1 if child_noattendhh>1 & child_noattendhh<. *replace child_noattendhh=. if attendance_missing_finalhh>=1 & attendance_missing_finalhh<. *replace child_noattendhh=. if child_noattendhh==0 & attendance_missing_finalhh>=1 & attendance_missing_finalhh>(1/3*child_7_14hh) replace child_noattendhh=. if child_noattendhh==0 & attendance_missinghh>=1 & attendance_missinghh>(1/3*child_7_14hh) replace child_noattendhh=0 if child_6_14hh>0 & child_6_14hh<. & child_7_14hh==0 *** B- HEALTH DIMENSION *** /* For the nutritional indicator, in DHS countries, if nutritional information for women and children in the household was missing and these were households with applicable members (that is with children and/or women), we consider the household as missing this indicator. Otherwise, we used the available information. Similarly, for child mortality, households that had applicable members who did not respond to the mortality question are considered to be missing this information; otherwise the household is considered non-deprived. */ ** 1- DEPRIVED IN NUTRITION ** /* Adults are considered malnourished if their BMI is below 18.5. Children are considered malnourished if their z-score of weight-for-age is below minus two standard deviations from the median of the reference population. DHS contains nutritional information on women between 15 and 49 years (Body Mass Index, BMI hereafter) and on the under-5-year-old children of the household (weight and height). This allows constructing a composite indicator which considers a household to be deprived (and therefore all its members) if there is either a woman or a child undernourished in the household. */ * WOMEN'S UNDERNUTRITION (BMI<18.5) * gen w=1 if sex==0 & age>=15 & age<=49 egen whh=sum(w), by(hhid) gen bmi=(ha2/(ha3^2))*100000 replace bmi=. if (ha2>=9994 & ha2<=9999) | (ha3>=9994 & ha3<=9999) | ha40==9998 | ha40==9999 gen malnourishedw = 1 if bmi<18.5 replace malnourishedw=0 if bmi>=18.5 & bmi<. egen malnourishedwhh=sum(malnourishedw), by (hhid) missing gen missing_bmi=1 if ha40>=9996 & ha40<=9999 egen missing_bmihh=sum(missing_bmi), by(hhid) missing gen nomissing_bmi=1 if ha40<9996 egen nomissing_bmihh=sum(nomissing_bmi), by(hhid) missing gen noaplic_bmi=1 if ha40==. egen noaplic_bmihh=sum(noaplic_bmi), by(hhid) missing gen womanbmi=1 if ha40<. egen womanbmihh=sum(womanbmi), by(hhid) missing gen missing_bmi_finalhh=1 if missing_bmihh>=1 & missing_bmihh<. & nomissing_bmihh==. gen uno_bmi=1 if bmi<. egen nw_bmi=sum(uno_bmi), by (hhid) ren malnourishedwhh nmalnourishedwhh gen malnourishedwhh=1 if nmalnourishedwhh>=1 & nmalnourishedwhh<. replace malnourishedwhh=0 if nmalnourishedwhh==0 replace missing_bmi_finalhh=1 if malnourishedwhh==0 & whh>(2*nw_bmi) & nw_bmi<. replace missing_bmihh=1 if malnourishedwhh==0 & whh>(2*nw_bmi) & nw_bmi<. replace malnourishedwhh=. if malnourishedwhh==0 & whh>(2*nw_bmi) & nw_bmi<. * MEN'S UNDERNUTRITION (BMI<18.5) * capture drop m mhh gen m=1 if sex==1 & age>=15 & age<=59 egen mhh=sum(m), by(hhid) gen mbmi=(hb2/(hb3^2))*100000 replace mbmi=. if (hb2>=9994 & hb2<=9999) | (hb3>=9994 & hb3<=9999) | hb40==9998 | hb40==9999 gen malnourishedm = 1 if mbmi<18.5 replace malnourishedm=0 if mbmi>=18.5 & mbmi<. egen malnourishedmhh=sum(malnourishedm), by (hhid) missing gen missing_mbmi=1 if hb40>=9996 & hb40<=9999 egen missing_mbmihh=sum(missing_mbmi), by(hhid) missing gen nomissing_mbmi=1 if hb40<9996 egen nomissing_mbmihh=sum(nomissing_mbmi), by(hhid) missing gen noaplic_mbmi=1 if hb40==. egen noaplic_mbmihh=sum(noaplic_mbmi), by(hhid) missing gen manbmi=1 if hb40<. egen manbmihh=sum(manbmi), by(hhid) missing gen missing_mbmi_finalhh=1 if missing_mbmihh>=1 & missing_mbmihh<. & nomissing_mbmihh==. gen uno_mbmi=1 if mbmi<. egen nm_bmi=sum(uno_mbmi), by (hhid) ren malnourishedmhh nmalnourishedmhh gen malnourishedmhh=1 if nmalnourishedmhh>=1 & nmalnourishedmhh<. replace malnourishedmhh=0 if nmalnourishedmhh==0 replace missing_mbmi_finalhh=1 if malnourishedmhh==0 & mhh>(2*nm_bmi) & nm_bmi<. replace missing_mbmihh=1 if malnourishedmhh==0 & mhh>(2*nm_bmi) & nm_bmi<. replace malnourishedmhh=. if malnourishedmhh==0 & mhh>(2*nm_bmi) & nm_bmi<. sort hv001 hv002 hvidx save "Dominican Republic_MPI2_2013.dta", replace /* clear set maxvar 7000 use "C:\Users\cecilia.calderon\HDRO_MCC\MPI\MPI_new calculations\Dominican 2013_DHS\Dominican Republic_MPI2_2013.dta", clear keep hc27 hc1 hc2 hc3 hc13 hc15 weight hv001 hv002 hvidx * Variable “Sex” (1=male; 2=female) tab hc27, miss gen gender = hc27 desc gender tab gender * Variable “Age”can be expresses it in months or days tab hc1, miss codebook hc1 gen age_months = hc1 desc age_months summ age_months gen str6 ageunit = "months" label var ageunit "Months" *Variable “Sampling weight” ren weight sw desc sw summ sw * Variable “body weight” – it must be in kilograms ta hc2, miss codebook hc2 gen weight = hc2/10 if hc2<9000 desc weight replace weight=. if hc13>0 tab hc2 hc13 if hc13>0, miss summ weight * Variable “height” – it must be in centimetres ta hc3, miss codebook hc3 gen height = hc3/10 if hc3<9000 desc height replace height=. if hc13>0 tab hc3 hc13 if hc13>0, miss summ height codebook hc15 gen measure = "l" if hc15==1 replace measure = "h" if hc15==2 replace measure = " " if hc15==0 | hc15==9 | hc15==. desc measure tab measure *Variable “Oedema” gen oedema=. desc oedema keep hv001 hv002 hvidx gender age_months ageunit weight height oedema measure sw save "C:\Users\cecilia.calderon\HDRO_MCC\MPI\WHO igrowup STATA\WHO igrowup workdata\DR2013_survey.dta", replace * THIS RUNS THE ANTHRO ADO FILE FROM WHO * /* Example: survey_standard.do using survey.dta */ clear set more 1 /* Higher memory might be necessary for larger datasets */ set memory 20m set maxvar 10000 /* Indicate to the Stata compiler where the igrowup_standard.ado file is stored*/ adopath + "C:\Users\cecilia.calderon\HDRO_MCC\MPI\WHO igrowup STATA\" /* Load the data file */ use "C:\Users\cecilia.calderon\HDRO_MCC\MPI\WHO igrowup STATA\WHO igrowup workdata\DR2013_survey.dta", clear /* generate the first three parameters reflib, datalib & datalab */ gen str60 reflib="C:\igrowup_stata" lab var reflib "Directory of reference tables" gen str60 datalib="C:\Users\cecilia.calderon\HDRO_MCC\MPI\WHO igrowup STATA\WHO igrowup workdata" lab var datalib "Directory for datafiles" gen str30 datalab="DR2013_survey" lab var datalab "Working file" /* check the variable for "sex" 1 = male, 2=female */ desc gender tab gender /* check the variable for "age" */ ren age_months agemons desc agemons summ agemons /* define your ageunit */ *gen str6 ageunit="months" /* or gen ageunit="days" */ *lab var ageunit "=days or =months" /* check the variable for body "weight" which must be in kilograms*/ /* NOTE: if not available, please create as [gen weight=.]*/ desc weight summ weight /* check the variable for "height" which must be in centimeters*/ /* NOTE: if not available, please create as [gen height=.]*/ desc height summ height /* check the variable for "measure"*/ /* NOTE: if not available, please create as [gen str1 measure=" "]*/ desc measure tab measure /* check the variable for "headc" which must be in centimeters*/ /* NOTE: if not available, please create as [gen headc=.]*/ gen headc=. desc head summ head /* check the variable for "armc" which must be in in centimeters*/ /* NOTE: if not available, please create as [gen armc=.]*/ gen muac=. desc muac summ muac /* check the variable for "triskin" which must be in millimeters*/ /* NOTE: if not available, please create as [gen triskin=.]*/ gen triskin=. desc tri summ tri /* check the variable for "subskin" which must be in millimeters*/ /* NOTE: if not available, please create as [gen subskin=.]*/ gen subskin=. desc sub summ sub /* check the variable for "oedema"*/ /* NOTE: if not available, please create as [gen str1 oedema="n"]*/ desc oedema tab oedema /* check the variable for "sw" for the sampling weight*/ /* NOTE: if not available, please create as [gen sw=1]*/ desc sw summ sw /* Fill in the macro parameters to run the command */ igrowup_standard reflib datalib datalab gender agemons ageunit weight height measure head muac tri sub oedema sw keep hv001 hv002 hvidx agemons height _zwei _zlen _zbmi _zwfl _fwfl _flen _fwei _fbmi sort hv001 hv002 hvidx save "C:\Users\cecilia.calderon\HDRO_MCC\MPI\MPI_new calculations\Dominican 2013_DHS\DR2013_anthro.dta", replace */ use "Dominican Republic_MPI2_2013.dta", clear merge hv001 hv002 hvidx using "DR2013_anthro.dta" tab _merge drop _merge * UNDERNUTRITION USING Z SCORES CALCULATED WITH WHO CODE * * Weight-for-age * gen zwa = _zwei if _fwei==0 gen malnourishedw5 = 1 if zwa<=-2 replace malnourishedw5=0 if zwa>-2 & zwa<. egen malnourishedw5hh=sum(malnourishedw5), by (hhid) missing gen missing_zwa=1 if _fwei==1 | (hc2>9000 & hc2<=9999) | (hc13>0 & hc13<=9) egen missing_zwahh=sum(missing_zwa), by(hhid) missing gen nomissing_zwa=1 if _fwei==0 egen nomissing_zwahh=sum(nomissing_zwa), by(hhid) missing gen missing_zwa_finalhh=1 if missing_zwahh>=1 & missing_zwahh<. & nomissing_zwahh==. replace missing_zwa_finalhh=0 if missing_zwa_finalhh==. gen uno_zwa=1 if zwa<. egen nw_zwa=sum(uno_zwa), by (hhid) * Height-for-age * gen zha = _zlen if _flen==0 gen malnourished5 = 1 if zha<=-2 replace malnourished5=0 if zha>-2 & zha<. egen malnourished5hh=sum(malnourished5), by (hhid) missing gen missing_zha=1 if _flen==1 | (hc3>9000 & hc3<=9999) | (hc13>0 & hc13<=9) egen missing_zhahh=sum(missing_zha), by(hhid) missing gen nomissing_zha=1 if _flen==0 egen nomissing_zhahh=sum(nomissing_zha), by(hhid) missing gen missing_zha_finalhh=1 if missing_zhahh>=1 & missing_zhahh<. & nomissing_zhahh==. replace missing_zha_finalhh=0 if missing_zha_finalhh==. gen uno_zha=1 if zha<. egen nw_zha=sum(uno_zha), by (hhid) gen uno0_5=1 if age<=5 bys hhid: egen hhmember0_5 = sum(uno0_5) ren malnourished5hh nmalnourished5hh gen malnourished5hh=1 if nmalnourished5hh>=1 & nmalnourished5hh<. replace malnourished5hh=0 if nmalnourished5hh==0 replace missing_zha_finalhh=1 if malnourished5hh==0 & hhmember0_5>(2*nw_zha) & nw_zha<. replace missing_zhahh=1 if malnourished5hh==0 & hhmember0_5>(2*nw_zha) & nw_zha<. replace malnourished5hh=. if malnourished5hh==0 & hhmember0_5>(2*nw_zha) & nw_zha<. * Number of children 5y but not necessarily <60 months capture drop uno5 nc5 gen uno5=1 if age==5 egen nc5=sum(uno5), by(hhid) gen undernutritionhh=0 if malnourishedwhh==0 & malnourished5hh==0 replace undernutritionhh=0 if malnourishedwhh==0 & malnourished5hh==. & hhmember0_5==0 replace undernutritionhh=0 if malnourished5hh==0 & malnourishedwhh==. & whh==0 replace undernutritionhh=1 if (malnourishedwhh>0 & malnourishedwhh<.) | (malnourished5hh>0 & malnourished5hh<.) replace undernutritionhh=0 if undernutritionhh==. & malnourishedwhh==0 & malnourished5hh==. & (whh>0 | hhmember0_5>0) & nc5>0 & nc5<. & nc5==hhmember0_5 replace undernutritionhh=0 if undernutritionhh==. & malnourishedwhh==0 & malnourished5hh==. & (whh>0 | hhmember0_5>0) & nc5>0 & nc5<. & hhmember0_5>nc5 & (nw_zha/(hhmember0_5-nc5)>=(1/2)) replace undernutritionhh=0 if undernutritionhh==. & malnourishedwhh==. & malnourished5hh==. & (whh>0 | hhmember0_5>0) & nc5>0 & nc5<. & hhmember0_5>nc5 & (nw_zha/(hhmember0_5-nc5)>=(1/2)) & (nw_bmi>=(1/2)*whh) ** 2- DEPRIVED IN MORTALITY ** replace children_diedhh=0 if children_diedhh==. & whh==0 replace child_died5hh=0 if whh==0 & child_died5hh==. replace child_diedhh=0 if whh==0 & child_diedhh==. gen mortality5hh=0 if child_died5hh==0 replace mortality5hh=1 if (child_died5hh>=1 & child_died5hh<.) gen region = hv024 sort hv001 hv002 hvidx save "Dominican Republic_MPI2_2013.dta", replace * NON-ELIGIBLE POPULATION * gen uno7_14=1 if age>=7 & age<=14 bys hhid: egen hhmember7_14 = sum(uno7_14) gen uno15_49=1 if age>=15 & age<=49 & sex==0 bys hhid: egen hhmember15_49 = sum(uno15_49) capture drop uno0_5 hhmember0_5 gen uno0_5=1 if age<=5 bys hhid: egen hhmember0_5 = sum(uno0_5) gen uno7_14hh=0 if hhmember7_14==0 replace uno7_14hh=1 if hhmember7_14>=1 & hhmember7_14<. gen uno15_49hh=0 if hhmember15_49==0 replace uno15_49hh=1 if hhmember15_49>=1 & hhmember15_49<. gen uno0_5hh=0 if hhmember0_5==0 replace uno0_5hh=1 if hhmember0_5>=1 & hhmember0_5<. * Number of eligible children for anthropometrics egen nch05=sum(hv120), by(hhid) gen nutrihh=1 if undernutritionhh<. & (malnourished5hh<. | malnourishedwhh<.) replace nutrihh=3 if undernutritionhh==. & malnourished5hh==. & malnourishedwhh==. & uno15_49hh==0 & uno0_5hh==0 replace nutrihh=4 if undernutritionhh==. & malnourished5hh==. & malnourishedwhh==. & (uno15_49hh==1 | uno0_5hh==1) replace nutrihh=2 if undernutritionhh==. & nutrihh==. replace nutrihh=1 if undernutritionhh==0 & (malnourishedwhh==0 & malnourished5hh==. & (whh>0 | hhmember0_5>0) & nc5>0 & nc5<. & nc5==hhmember0_5) replace nutrihh=1 if undernutritionhh==0 & (malnourishedwhh==0 & malnourished5hh==. & (whh>0 | hhmember0_5>0) & nc5>0 & nc5<. & hhmember0_5>nc5 & (nw_zha/(hhmember0_5-nc5)>=(1/2))) replace nutrihh=3 if nutrihh==4 & hhmember0_5>0 & nc5==hhmember0_5 & whh==0 replace nutrihh=2 if nutrihh==4 & missing_bmihh>0 & missing_bmihh<. replace nutrihh=2 if nutrihh==4 & missing_zhahh>0 & missing_zhahh<. label define nutrihh 1 "HH with nutrition information" 2 "HH with missing information on nutrition" 3 "HH with no eligible population for nutrition (no children 0-5y & no women 15-49y)" 4 "HH with eligible population for nutrition but measures not taken" label values nutrihh nutrihh ** the following will take into account men Anthropometrics ** ren undernutritionhh undernutritionhh_old gen undernutritionhh = undernutritionhh_old replace undernutritionhh=1 if malnourishedmhh==1 replace undernutritionhh=0 if malnourishedmhh==0 & nutrihh==3 replace nutrihh=1 if undernutritionhh<. & undernutritionhh_old==. replace undernutritionhh=. if undernutritionhh_old==0 & missing_mbmi_finalhh==1 & undernutritionhh==0 replace nutrihh=2 if undernutritionhh_old==0 & missing_mbmi_finalhh==1 & undernutritionhh==. gen attehh=1 if child_noattendhh<. & uno7_14hh==1 replace attehh=2 if child_noattendhh==. replace attehh=3 if child_noattendhh==0 & uno7_14hh==0 replace attehh=1 if attehh==3 & child_6_14hh>0 & child_6_14hh<. & child_7_14hh==0 label define attehh 1 "HH with attendance information" 2 "HH with missing information on attendance" 3 "HH with no eligible population for attendace (no children 7-14y)" label values attehh attehh gen morthh=1 if mortality5hh<. & uno15_49hh==1 replace morthh=3 if mortality5hh==0 & uno15_49hh==0 replace morthh=4 if mortality5hh==. label define morthh 1 "HH with mortality information" 2 "HH with missing information on mortality" 3 "HH with no eligible population for mortality (no women 15-49y)" 4 "HH with eligible population for mortality but do not appear in fertility section" label values morthh morthh replace mortality5hh=0 if mortality5hh==. & merge_women==1 replace mortality5hh=. if mortality5hh==0 & whh>(2*nwomen15_49) & nwomen15_49<. replace morthh=2 if morthh==1 & mortality5hh==. & whh>(2*nwomen15_49) & nwomen15_49<. compress sort hv001 hv002 hvidx save "Dominican Republic_MPI2_2013.dta", replace ** DO FILE FROM OPHI TO COMPUTE MPI ** *************************************************************************** **** Multidimensional Poverty Measure ************************************* **** OPHI-HDCA Summer School 2011 ***************************************** **** 24 August to 3 September 2011 - Delft, the Netherlands *************** *************************************************************************** ** ADAPTED BY CECILIA ON MAY 2013 ** ** Dominican Republic 2013 ** clear set more off set maxvar 10000 set mem 500m cap log close *** Replace here your path to the dataset*** cd "C:\Users\cecilia.calderon\HDRO_MCC\MPI\MPI_new calculations\Dominican 2013_DHS\" *** Replace here the name of your dataset*** capture log close log using "M0_dofile_Dominican Republic2013_MPI2.log", text replace use "Dominican Republic_MPI2_2013.dta", clear ********************************************************************************* ******* Define the deprivation matrix **************************************** ********************************************************************************* *** The dataset can be interpreted as the matrix of achivemnts *** We will now crate the deprivation matrix based on the indicator definition; and deprivation cut-off defined by you *** during the last working session on the normative Issues in Multidimensional Poverty Measure *** In order to do this, we will generate a new variable for each indicator contained in our measure *** This will identify with 0 individuals or households who are not deprived in the specific indicator *** and identify with 1 individual deprived in the specific indicator. *** Note that you will need to replace with dot "." if the information is missing or inconsistent. *** We will assess later the frequency of missing values. ** DEPRIVED IN DRINKING WATER ** (the individual -HH- is considered deprived in drinking water is: unprotected well, spring, river/lake/pond or other) /*lookfor water codebook b2q12, tab(20) gen d_dwater=(b2q12==5 | b2q12==6 | b2q12==7 | b2q12==8) replace d_dwater=. if b2q12==. tab b2q12 d_dwater [aw=weight], miss label variable d_dwater "Deprived in drinking water"ic*/ ** Please follow the same logic for all indicators. ** Note that for advance indicator you may have to use more complex algorithms ***************************************************************************** ******** Create a local variable with all your indicators ********* ***************************************************************************** local varlist_pov electricity_depriv sanitation_depriv water_depriv floor_depriv cookingfuel_depriv asset_depriv educ_depriv child_noattendhh undernutritionhh mortality5hh ***************************************************************************** **** Define the weights ***************************** ***************************************************************************** ** Create a loop for the variables with the same weight ********************* ***************************************************************************** egen ls=rowmiss(electricity_depriv sanitation_depriv water_depriv floor_depriv cookingfuel_depriv asset_depriv) gen hh_missing=0 replace hh_missing=1 if educ_depriv==. | nutrihh==2 | attehh==2 | morthh==2 | (ls>0 & ls<.) foreach var in electricity_depriv sanitation_depriv water_depriv floor_depriv cookingfuel_depriv asset_depriv { gen w_`var'=1/18 if ls==0 } gen w_mortality5hh = 1/6 if morthh==1 & nutrihh==1 replace w_mortality5hh = 1/3 if morthh==1 & nutrihh==3 replace w_mortality5hh = 0 if morthh==3 & nutrihh==1 gen w_undernutritionhh = 1/6 if morthh==1 & nutrihh==1 replace w_undernutritionhh = 1/3 if morthh==3 & nutrihh==1 replace w_undernutritionhh = 0 if morthh==1 & nutrihh==3 gen w_child_noattendhh = 1/6 if attehh==1 | attehh==3 gen w_educ_depriv = 1/6 if educ_depriv<. ******************************************************************* ********* Define the weigthed deprivation g0* matrix **** ******************************************************************* foreach var in `varlist_pov' { gen wg0_`var' = `var'*w_`var' } ****************************************************************************** *********** Compute the frequency of missing values for indicator ************ ****************************************************************************** foreach var in `varlist_pov' { gen `var'_miss=1 if `var'==. replace `var'_miss=0 if `var'!=. } sum *_miss ******************************************************************************** ************* Define the (weighted) deprivation count vector "ci" ************ ******************************************************************************** egen ci=rsum(wg0_*) label variable ci "Deprivation Count" egen n_missing=rowmiss(wg0_*) label variable n_missing "Number of missing variables by individual" gen missing=(n_missing>0) label variable missing "Individual with missing variables" *** Check sample drop due to missing values tab missing ******************************************************************************* ***** Create de identification vector (poor/non poor) ************************* ***** and compute individual average of deprivation *************************** ******************************************************************************* forvalues x=1(1)10 { gen h_`x'0p=(ci>=`x'/10) replace h_`x'0p=. if missing==1 gen a_`x'0p=(ci) if h_`x'0p==1 replace a_`x'0p=. if missing==1 label var h_`x'0p "Condition of Multidimensional Poverty k=`x'" label var a_`x'0p "Individual Average deprivation k=`x'" } sum h_10p-a_100p [aw=weight] gen h_33p=(ci>=3.33/10) replace h_33p=. if missing==1 gen a_33p=(ci) if h_33p==1 replace a_33p=. if missing==1 label var h_33p "Condition of Multidimensional Poverty k=33.3" label var a_33p "Individual Average deprivation k=33.3" sum h_33p a_33p [aw=weight] ******************************************************************************** ******* Compute raw headcounts ****************************************** ******************************************************************************** foreach var in `varlist_pov' { gen `var'_raw=(`var') replace `var'_raw=. if missing==1 } su *_raw [iw=weight] ****************************************************************************** *********** Compute Censored headcount and censored headocunt **************** ****************************************************************************** ***** Please define in the first line your poverty cutoff, the example shows k=33.3 is 33.3% local k=1/3 foreach var in `varlist_pov' { *gen `var'_CH_`k'=(`var'==1 & h_`k'==1) *replace `var'_CH_`k'=. if missing==1 gen `var'_CH_33=(`var'==1 & h_33==1) replace `var'_CH_33=. if missing==1 } sum electricity_depriv_CH_33-educ_depriv_CH_33 [iw=weight] sum h_33 a_33 [iw=weight] *h = HC *a = intensity capture drop cedu chealth cls scalar drop _all gen cedu = (child_noattendhh_CH_33 * w_child_noattendhh) + (educ_depriv_CH_33 * w_educ_depriv) sum cedu [iw=weight] scalar mpi_edu=r(mean) gen chealth = (mortality5hh_CH_33 * w_mortality5hh) + (undernutritionhh_CH_33 * w_undernutritionhh) sum chealth [iw=weight] scalar mpi_health=r(mean) gen cls = (electricity_depriv_CH_33 * w_electricity_depriv) + (sanitation_depriv_CH_33 * w_sanitation_depriv) + (water_depriv_CH_33 * w_water_depriv) + (floor_depriv_CH_33 * w_floor_depriv) + (cookingfuel_depriv_CH_33 * w_cookingfuel_depriv) + (asset_depriv_CH_33 * w_asset_depriv) sum cls [iw=weight] scalar mpi_ls=r(mean) sum a_33p [iw=weight] scalar intensity = r(mean) sum h_33p [iw=weight] scalar headcount = r(mean) scalar mpi=headcount*intensity scalar headcount100=headcount*100 scalar intensity100=intensity*100 scalar edu_contrib = (mpi_edu/mpi)*100 scalar health_contrib = (mpi_health/mpi)*100 scalar ls_contrib = (mpi_ls/mpi)*100 capture drop uno gen uno=1 if h_33p<. sum uno [aw=weight] if h_33p<. scalar pop=r(sum_w) sum uno [aw=weight] if h_33p<. & ci>0 & ci<(1/3) scalar pop_vuln0=r(sum_w) sum uno [aw=weight] if h_33p<. & ci>=0.2 & ci<(1/3) scalar pop_vuln20=r(sum_w) sum uno [aw=weight] if h_33p<. & ci>=0.5 scalar pop_severe=r(sum_w) scalar vulnerable0=(pop_vuln0/pop)*100 scalar vulnerable20=(pop_vuln20/pop)*100 scalar severity=(pop_severe/pop)*100 * Sample size * HHs capture drop hh egen hh=group(hv001 hv002) sort age bys hh: gen n=_n gen nhh=1 if n==1 * Individuals capture drop uno gen uno=1 sum uno scalar ind_sample_tot=r(N) sum uno if h_33p<. scalar ind_sample_used=r(N) sum uno [w=weight] if h_33p<. scalar ind_sample_used_w=r(sum) sum nhh scalar hh_sample_tot=r(N) sum nhh if h_33p<. scalar hh_sample_used=r(N) sum nhh [w=weight] if h_33p<. scalar hh_sample_used_w=r(sum) * Inequality sum a_33p [aw=weight] scalar cv_ineq_poor = r(sd)/r(mean) sum ci [aw=weight] if h_33p<. scalar cv_ineq_hc = r(sd)/r(mean) sum ci [aw=weight] if h_33p<. & ci>0 scalar cv_ineq_positive = r(sd)/r(mean) * CONTRIBUTION OF EACH DIMENSION FOR THE VULNERABLE POEPLE foreach var in `varlist_pov' { gen `var'_CH_33vu=0 if h_33p<. & ci>=0.2 & ci<(1/3) replace `var'_CH_33vu=1 if `var'==1 & h_33p<. & ci>=0.2 & ci<(1/3) replace `var'_CH_33vu=. if missing==1 } gen ceduvu = (child_noattendhh_CH_33vu * w_child_noattendhh) + (educ_depriv_CH_33vu * w_educ_depriv) sum ceduvu [iw=weight] if h_33p<. & ci>=0.2 & ci<(1/3) scalar mpi_eduvu=r(mean) gen chealthvu = (mortality5hh_CH_33vu * w_mortality5hh) + (undernutritionhh_CH_33vu * w_undernutritionhh) sum chealthvu [iw=weight] if h_33p<. & ci>=0.2 & ci<(1/3) scalar mpi_healthvu=r(mean) gen clsvu = (asset_depriv_CH_33vu * w_asset_depriv) + (electricity_depriv_CH_33vu * w_electricity_depriv) + (sanitation_depriv_CH_33vu * w_sanitation_depriv) + (water_depriv_CH_33vu * w_water_depriv) + (floor_depriv_CH_33vu * w_floor_depriv) + (cookingfuel_depriv_CH_33vu * w_cookingfuel_depriv) sum clsvu [iw=weight] if h_33p<. & ci>=0.2 & ci<(1/3) scalar mpi_lsvu=r(mean) sum ci [iw=weight] if h_33p<. & ci>=0.2 & ci<(1/3) scalar headcountvu = r(mean) scalar headcountvu100=headcountvu*100 scalar edu_contribvu = (mpi_eduvu/headcountvu100)*10000 scalar health_contribvu = (mpi_healthvu/headcountvu100)*10000 scalar ls_contribvu = (mpi_lsvu/headcountvu100)*10000 scalar list mpi headcount100 intensity100 vulnerable0 vulnerable20 severity edu_contrib health_contrib ls_contrib edu_contribvu health_contribvu ls_contribvu cv_ineq_poor cv_ineq_positive cv_ineq_hc hh_sample_tot hh_sample_used hh_sample_used_w ind_sample_tot ind_sample_used ind_sample_used_w gen sample6y=1 if h_33p<. gen ineligible=0 replace ineligible=1 if (whh==0 & hhmember0_5==0) | (whh==0 & hhmember0_5>0 & hhmember0_5==nc5 & nutrihh==3) gen sample_all=1 sort hv001 hv002 hvidx save "Dominican Republic_MPI2_2013_final.dta", replace capture log close ******************** *** RE-WEIGHTING *** ******************** clear use "Dominican Republic_MPI2_2013_final.dta", clear gen age_group=1 if age>=0 & age<=5 replace age_group=2 if age>=6 & age<=14 replace age_group=3 if age>=15 & age<=49 replace age_group=4 if age>=50 & age<. set more off scalar drop _all forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { sum sample_all [w=weight] if age_group==`a' & sex==`s' & urban==`u' scalar sample_`a'_`s'_`u' = r(sum_w) } } } *************************************************************************** **** MISSING IN THE 3 VARIABLES (we don't observe sex, age and urban) ***** *************************************************************************** sum sample_all [w=weight] if (sex==. & urb==. & age_g==.) | (sex<. & urb<. & age_g<.) scalar sample_mnm = r(sum_w) sum sample_all [w=weight] if (sex<. & urb<. & age_g<.) scalar sample_nm = r(sum_w) scalar ratio_all = sample_mnm / sample_nm forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { scalar sample_nm_`a'_`s'_`u' = ratio_all * sample_`a'_`s'_`u' } } } ************************************************************************************** **** MPI SAMPLE MISSING IN THE 3 VARIABLES (we don't observe sex, age and urban) ***** ************************************************************************************** * NEW MPI SAMPLE forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { sum sample_all [w=weight] if age_group==`a' & sex==`s' & urban==`u' & sample6y==1 scalar sample_`a'_`s'_`u'_6y = r(sum_w) } } } sum sample_all [w=weight] if sample6y==1 & ((sex==. & urb==. & age_g==.) | (sex<. & urb<. & age_g<.)) scalar sample_mnm_6y = r(sum_w) sum sample_all [w=weight] if (sex<. & urb<. & age_g<.) & sample6y==1 scalar sample_nm_6y = r(sum_w) scalar ratio_all_6y = sample_mnm_6y / sample_nm_6y forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { scalar sample_nm_`a'_`s'_`u'_6y = ratio_all_6y * sample_`a'_`s'_`u'_6y } } } ************************************************************************************** **** MISSING IN TWO VARIABLES AT A TIME (we only observe one: sex, age or urban) ***** ************************************************************************************** * ONLY OBSERVE SEX forvalues s = 0(1)1 { sum sample_all [w=weight] if sex==`s' & (sex<. & urb==. & age_g==.) scalar sample_m_`s's_onlysex = r(sum_w) sum sample6y [w=weight] if sex==`s' & (sex<. & urb==. & age_g==.) scalar sample_m_`s's_onlysex_6y = r(sum_w) } forvalues s = 0(1)1 { scalar samplenew_`s's = sample_nm_4_`s'_1 + sample_nm_4_`s'_0 + sample_nm_3_`s'_1 + sample_nm_3_`s'_0 + sample_nm_2_`s'_1 + sample_nm_2_`s'_0 + sample_nm_1_`s'_1 + sample_nm_1_`s'_0 scalar samplenew_`s's_onlysex = samplenew_`s's + sample_m_`s's_onlysex scalar samplenew_`s's_6y = sample_nm_4_`s'_1_6y + sample_nm_4_`s'_0_6y + sample_nm_3_`s'_1_6y + sample_nm_3_`s'_0_6y + sample_nm_2_`s'_1_6y + sample_nm_2_`s'_0_6y + sample_nm_1_`s'_1_6y + sample_nm_1_`s'_0_6y scalar samplenew_`s's_onlysex_6y = samplenew_`s's_6y + sample_m_`s's_onlysex_6y } forvalues s = 0(1)1 { scalar ratio_`s's_onlysex = samplenew_`s's_onlysex / samplenew_`s's scalar ratio_`s's_onlysex_6y = samplenew_`s's_onlysex_6y / samplenew_`s's_6y } forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { scalar sample_onlysex_`a'a_`s's_`u'u_all = sample_nm_`a'_`s'_`u' * ratio_`s's_onlysex scalar sample_onlysex_`a'a_`s's_`u'u_6y = sample_nm_`a'_`s'_`u'_6y * ratio_`s's_onlysex_6y } } } * ONLY OBSERVE AGE forvalues a = 1(1)4 { sum sample_all [w=weight] if age_g==`a' & (sex==. & urb==. & age_g<.) scalar sample_m_`a'a_onlyage = r(sum_w) sum sample6y [w=weight] if age_g==`a' & (sex==. & urb==. & age_g<.) scalar sample_m_`a'a_onlyage_6y = r(sum_w) } forvalues a = 1(1)4 { scalar samplenew_`a'a = sample_onlysex_`a'a_1s_1u_all + sample_onlysex_`a'a_1s_0u_all + sample_onlysex_`a'a_0s_1u_all + sample_onlysex_`a'a_0s_0u_all scalar samplenew_`a'a_onlyage = samplenew_`a'a + sample_m_`a'a_onlyage scalar samplenew_`a'a_6y = sample_onlysex_`a'a_1s_1u_6y + sample_onlysex_`a'a_1s_0u_6y + sample_onlysex_`a'a_0s_1u_6y + sample_onlysex_`a'a_0s_0u_6y scalar samplenew_`a'a_onlyage_6y = samplenew_`a'a_6y + sample_m_`a'a_onlyage_6y } forvalues a = 1(1)4 { scalar ratio_`a'a_onlyage = samplenew_`a'a_onlyage / samplenew_`a'a scalar ratio_`a'a_onlyage_6y = samplenew_`a'a_onlyage_6y / samplenew_`a'a_6y } forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { scalar sample_onlyage_`a'a_`s's_`u'u_all = sample_onlysex_`a'a_`s's_`u'u_all * ratio_`a'a_onlyage scalar sample_onlyage_`a'a_`s's_`u'u_6y = sample_onlysex_`a'a_`s's_`u'u_6y * ratio_`a'a_onlyage_6y } } } * ONLY OBSERVE URBAN forvalues u = 0(1)1 { sum sample_all [w=weight] if urban==`u' & (sex==. & urb<. & age_g==.) scalar sample_m_`u'u_onlyurb = r(sum_w) sum sample6y [w=weight] if urban==`u' & (sex==. & urb<. & age_g==.) scalar sample_m_`u'u_onlyurb_6y = r(sum_w) } forvalues u = 0(1)1 { scalar samplenew_`u'u = sample_onlyage_4a_1s_`u'u_all + sample_onlyage_4a_0s_`u'u_all + sample_onlyage_3a_1s_`u'u_all + sample_onlyage_3a_0s_`u'u_all + sample_onlyage_2a_1s_`u'u_all + sample_onlyage_2a_0s_`u'u_all + sample_onlyage_1a_1s_`u'u_all + sample_onlyage_1a_0s_`u'u_all scalar samplenew_`u'u_onlyurb = samplenew_`u'u + sample_m_`u'u_onlyurb scalar samplenew_`u'u_6y = sample_onlyage_4a_1s_`u'u_6y + sample_onlyage_4a_0s_`u'u_6y + sample_onlyage_3a_1s_`u'u_6y + sample_onlyage_3a_0s_`u'u_6y + sample_onlyage_2a_1s_`u'u_6y + sample_onlyage_2a_0s_`u'u_6y + sample_onlyage_1a_1s_`u'u_6y + sample_onlyage_1a_0s_`u'u_6y scalar samplenew_`u'u_onlyurb_6y = samplenew_`u'u_6y + sample_m_`u'u_onlyurb_6y } forvalues u = 0(1)1 { scalar ratio_`u'u_onlyurb = samplenew_`u'u_onlyurb / samplenew_`u'u scalar ratio_`u'u_onlyurb_6y = samplenew_`u'u_onlyurb_6y / samplenew_`u'u_6y } forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { scalar sample_onlyurb_`a'a_`s's_`u'u_all = sample_onlyage_`a'a_`s's_`u'u_all * ratio_`u'u_onlyurb scalar sample_onlyurb_`a'a_`s's_`u'u_6y = sample_onlyage_`a'a_`s's_`u'u_6y * ratio_`u'u_onlyurb_6y } } } *********************************************************************** **** MISSING IN ONE VARIABLE AT A TIME (either sex, age or urban) ***** *********************************************************************** * missing sex forvalues a=1(1)4 { forvalues u=0(1)1 { sum sample_all [w=weight] if age_group==`a' & urban==`u' & (sex==. & age_g<. & urban<.) scalar sample_m_`a'a_`u'u = r(sum_w) sum sample6y [w=weight] if age_group==`a' & urban==`u' & (sex==. & age_g<. & urban<.) scalar sample_m_`a'a_`u'u_6y = r(sum_w) } } * SEX MISSING: COLLAPSE THE 16 GROUPS INTO 8 GROUPS (AGE-URBAN) forvalues a=1(1)4 { forvalues u=0(1)1 { scalar samplenew_`a'a_`u'u = sample_onlyurb_`a'a_1s_`u'u_all + sample_onlyurb_`a'a_0s_`u'u_all scalar samplenew_`a'a_`u'u_sexm = samplenew_`a'a_`u'u + sample_m_`a'a_`u'u scalar samplenew_`a'a_`u'u_6y = sample_onlyurb_`a'a_1s_`u'u_6y + sample_onlyurb_`a'a_0s_`u'u_6y scalar samplenew_`a'a_`u'u_sexm_6y = samplenew_`a'a_`u'u_6y + sample_m_`a'a_`u'u_6y } } forvalues a=1(1)4 { forvalues u = 0(1)1 { scalar ratio_`a'a_`u'u = samplenew_`a'a_`u'u_sexm / samplenew_`a'a_`u'u scalar ratio_`a'a_`u'u_6y = samplenew_`a'a_`u'u_sexm_6y / samplenew_`a'a_`u'u_6y } } forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { scalar sample_sexmis_`a'a_`s's_`u'u_all = sample_onlyurb_`a'a_`s's_`u'u_all * ratio_`a'a_`u'u scalar sample_sexmis_`a'a_`s's_`u'u_6y = sample_onlyurb_`a'a_`s's_`u'u_6y * ratio_`a'a_`u'u_6y } } } * missing age forvalues s=0(1)1 { forvalues u=0(1)1 { sum sample_all [w=weight] if sex==`s' & urban==`u' & (sex<. & age_g==. & urban<.) scalar sample_m_`s's_`u'u = r(sum_w) sum sample6y [w=weight] if sex==`s' & urban==`u' & (sex<. & age_g==. & urban<.) scalar sample_m_`s's_`u'u_6y = r(sum_w) } } * AGE MISSING: COLLAPSE THE 16 GROUPS INTO 4 GROUPS (SEX-URBAN) forvalues s=0(1)1 { forvalues u=0(1)1 { scalar samplenew_`s's_`u'u = sample_sexmis_4a_`s's_`u'u_all + sample_sexmis_3a_`s's_`u'u_all + sample_sexmis_2a_`s's_`u'u_all + sample_sexmis_1a_`s's_`u'u_all scalar samplenew_`s's_`u'u_agem = samplenew_`s's_`u'u + sample_m_`s's_`u'u scalar samplenew_`s's_`u'u_6y = sample_sexmis_4a_`s's_`u'u_6y + sample_sexmis_3a_`s's_`u'u_6y + sample_sexmis_2a_`s's_`u'u_6y + sample_sexmis_1a_`s's_`u'u_6y scalar samplenew_`s's_`u'u_agem_6y = samplenew_`s's_`u'u_6y + sample_m_`s's_`u'u_6y } } forvalues s=0(1)1 { forvalues u = 0(1)1 { scalar ratio_`s's_`u'u = samplenew_`s's_`u'u_agem / samplenew_`s's_`u'u scalar ratio_`s's_`u'u_6y = samplenew_`s's_`u'u_agem_6y / samplenew_`s's_`u'u_6y } } forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { scalar sample_agemis_`a'a_`s's_`u'u_all = sample_sexmis_`a'a_`s's_`u'u_all * ratio_`s's_`u'u scalar sample_agemis_`a'a_`s's_`u'u_6y = sample_sexmis_`a'a_`s's_`u'u_6y * ratio_`s's_`u'u_6y } } } * missing urban forvalues a=1(1)4 { forvalues s=0(1)1 { sum sample_all [w=weight] if age_g==`a' & sex==`s' & (sex<. & age_g<. & urban==.) scalar sample_m_`a'a_`s's = r(sum_w) sum sample6y [w=weight] if age_g==`a' & sex==`s' & (sex<. & age_g<. & urban==.) scalar sample_m_`a'a_`s's_6y = r(sum_w) } } * URBAN MISSING: COLLAPSE THE 16 GROUPS INTO 8 GROUPS (AGE-SEX) forvalues a=1(1)4 { forvalues s=0(1)1 { scalar samplenew_`a'a_`s's = sample_agemis_`a'a_`s's_1u_all + sample_agemis_`a'a_`s's_0u_all scalar samplenew_`a'a_`s's_urbm = samplenew_`a'a_`s's + sample_m_`a'a_`s's scalar samplenew_`a'a_`s's_6y = sample_agemis_`a'a_`s's_1u_6y + sample_agemis_`a'a_`s's_0u_6y scalar samplenew_`a'a_`s's_urbm_6y = samplenew_`a'a_`s's_6y + sample_m_`a'a_`s's_6y } } forvalues a=1(1)4 { forvalues s = 0(1)1 { scalar ratio_`a'a_`s's = samplenew_`a'a_`s's_urbm / samplenew_`a'a_`s's scalar ratio_`a'a_`s's_6y = samplenew_`a'a_`s's_urbm_6y / samplenew_`a'a_`s's_6y } } forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { scalar sample_urbmis_`a'a_`s's_`u'u_all = sample_agemis_`a'a_`s's_`u'u_all * ratio_`a'a_`s's scalar sample_urbmis_`a'a_`s's_`u'u_6y = sample_agemis_`a'a_`s's_`u'u_6y * ratio_`a'a_`s's_6y } } } ********************************************************************** *** CORRECTING THE ORIGINAL WEIGHTS FOR EVERYONE IN THE MPI SAMPLE *** ********************************************************************** * COLLAPSE THE CORRECTED CELLS INTO DIFFERENT GROUPS ACCORDING TO THEIR MISSINGS TO CORRECT THE WEIGHTS OF THE OBSERVATIONS IN THE MPI SAMPLE WITH MISSINGS IN AGE, SEX AND OR URBAN * SEX, AGE AND URBAN MISSING scalar total_all = sample_urbmis_4a_1s_1u_all + sample_urbmis_4a_1s_0u_all + sample_urbmis_4a_0s_1u_all + sample_urbmis_4a_0s_0u_all + sample_urbmis_3a_1s_1u_all + sample_urbmis_3a_1s_0u_all + sample_urbmis_3a_0s_1u_all + sample_urbmis_3a_0s_0u_all + sample_urbmis_2a_1s_1u_all + sample_urbmis_2a_1s_0u_all + sample_urbmis_2a_0s_1u_all + sample_urbmis_2a_0s_0u_all + sample_urbmis_1a_1s_1u_all + sample_urbmis_1a_1s_0u_all + sample_urbmis_1a_0s_1u_all + sample_urbmis_1a_0s_0u_all scalar total_6y = sample_urbmis_4a_1s_1u_6y + sample_urbmis_4a_1s_0u_6y + sample_urbmis_4a_0s_1u_6y + sample_urbmis_4a_0s_0u_6y + sample_urbmis_3a_1s_1u_6y + sample_urbmis_3a_1s_0u_6y + sample_urbmis_3a_0s_1u_6y + sample_urbmis_3a_0s_0u_6y + sample_urbmis_2a_1s_1u_6y + sample_urbmis_2a_1s_0u_6y + sample_urbmis_2a_0s_1u_6y + sample_urbmis_2a_0s_0u_6y + sample_urbmis_1a_1s_1u_6y + sample_urbmis_1a_1s_0u_6y + sample_urbmis_1a_0s_1u_6y + sample_urbmis_1a_0s_0u_6y scalar ratio_total = total_all / total_6y * ONLY OBSERVE SEX forvalues s = 0(1)1 { scalar total_sex`s'_all = sample_urbmis_4a_`s's_1u_all + sample_urbmis_4a_`s's_0u_all + sample_urbmis_3a_`s's_1u_all + sample_urbmis_3a_`s's_0u_all + sample_urbmis_2a_`s's_1u_all + sample_urbmis_2a_`s's_0u_all + sample_urbmis_1a_`s's_1u_all + sample_urbmis_1a_`s's_0u_all scalar total_sex`s'_6y = sample_urbmis_4a_`s's_1u_6y + sample_urbmis_4a_`s's_0u_6y + sample_urbmis_3a_`s's_1u_6y + sample_urbmis_3a_`s's_0u_6y + sample_urbmis_2a_`s's_1u_6y + sample_urbmis_2a_`s's_0u_6y + sample_urbmis_1a_`s's_1u_6y + sample_urbmis_1a_`s's_0u_6y scalar ratio_total_sex`s' = total_sex`s'_all / total_sex`s'_6y } * ONLY OBSERVE AGE forvalues a = 1(1)4 { scalar total_age`a'_all = sample_urbmis_`a'a_1s_1u_all + sample_urbmis_`a'a_1s_0u_all + sample_urbmis_`a'a_0s_1u_all + sample_urbmis_`a'a_0s_0u_all scalar total_age`a'_6y = sample_urbmis_`a'a_1s_1u_6y + sample_urbmis_`a'a_1s_0u_6y + sample_urbmis_`a'a_0s_1u_6y + sample_urbmis_`a'a_0s_0u_6y scalar ratio_total_age`a' = total_age`a'_all / total_age`a'_6y } * ONLY OBSERVE URBAN forvalues u = 0(1)1 { scalar total_urb`u'_all = sample_urbmis_4a_1s_`u'u_all + sample_urbmis_4a_0s_`u'u_all + sample_urbmis_3a_1s_`u'u_all + sample_urbmis_3a_0s_`u'u_all + sample_urbmis_2a_1s_`u'u_all + sample_urbmis_2a_0s_`u'u_all + sample_urbmis_1a_1s_`u'u_all + sample_urbmis_1a_0s_`u'u_all scalar total_urb`u'_6y = sample_urbmis_4a_1s_`u'u_6y + sample_urbmis_4a_0s_`u'u_6y + sample_urbmis_3a_1s_`u'u_6y + sample_urbmis_3a_0s_`u'u_6y + sample_urbmis_2a_1s_`u'u_6y + sample_urbmis_2a_0s_`u'u_6y + sample_urbmis_1a_1s_`u'u_6y + sample_urbmis_1a_0s_`u'u_6y scalar ratio_total_urb`u' = total_urb`u'_all / total_urb`u'_6y } * SEX MISSING ONLY forvalues a = 1(1)4 { forvalues u = 0(1)1 { scalar total_sexmis_`a'a_`u'u_all = sample_urbmis_`a'a_1s_`u'u_all + sample_urbmis_`a'a_0s_`u'u_all scalar total_sexmis_`a'a_`u'u_6y = sample_urbmis_`a'a_1s_`u'u_6y + sample_urbmis_`a'a_0s_`u'u_6y scalar ratio_total_sexmis_`a'a_`u'u = total_sexmis_`a'a_`u'u_all / total_sexmis_`a'a_`u'u_6y } } * AGE MISSING ONLY forvalues s = 0(1)1 { forvalues u = 0(1)1 { scalar total_agemis_`s's_`u'u_all = sample_urbmis_4a_`s's_`u'u_all + sample_urbmis_3a_`s's_`u'u_all + sample_urbmis_2a_`s's_`u'u_all + sample_urbmis_1a_`s's_`u'u_all scalar total_agemis_`s's_`u'u_6y = sample_urbmis_4a_`s's_`u'u_6y + sample_urbmis_3a_`s's_`u'u_6y + sample_urbmis_2a_`s's_`u'u_6y + sample_urbmis_1a_`s's_`u'u_6y scalar ratio_total_agemis_`s's_`u'u = total_agemis_`s's_`u'u_all / total_agemis_`s's_`u'u_6y } } * URBAN MISSING ONLY forvalues a = 1(1)4 { forvalues s = 0(1)1 { scalar total_urbmis_`a'a_`s's_all = sample_urbmis_`a'a_`s's_1u_all + sample_urbmis_`a'a_`s's_0u_all scalar total_urbmis_`a'a_`s's_6y = sample_urbmis_`a'a_`s's_1u_6y + sample_urbmis_`a'a_`s's_0u_6y scalar ratio_total_urbmis_`a'a_`s's = total_urbmis_`a'a_`s's_all / total_urbmis_`a'a_`s's_6y } } * DEFINE THE RATIOS FOR NON-MISSING VALUES IN SEX, AGE AND URBAN forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { scalar sample_all_`a'_`s'_`u'_w = sample_urbmis_`a'a_`s's_`u'u_all / sample_urbmis_`a'a_`s's_`u'u_6y } } } capture drop weight_w gen weight_w = weight if sample6y==1 *& age_group<. & sex<. & urban<. forvalues a=1(1)4 { forvalues s=0(1)1 { forvalues u=0(1)1 { replace weight_w = weight * sample_all_`a'_`s'_`u'_w if age_group==`a' & sex==`s' & urban==`u' & sample6y==1 } } } replace weight_w = weight * ratio_total if sample6y==1 & age_group==. & sex==. & urban==. forvalues s=0(1)1 { replace weight_w = weight * ratio_total_sex`s' if sample6y==1 & age_group==. & sex==`s' & urban==. } forvalues a=1(1)4 { replace weight_w = weight * ratio_total_age`a' if sample6y==1 & age_group==`a' & sex==. & urban==. } forvalues u=0(1)1 { replace weight_w = weight * ratio_total_urb`u' if sample6y==1 & age_group==. & sex==. & urban==`u' } forvalues a = 1(1)4 { forvalues u = 0(1)1 { replace weight_w = weight * ratio_total_sexmis_`a'a_`u'u if sample6y==1 & age_group==`a' & sex==. & urban==`u' } } forvalues s = 0(1)1 { forvalues u = 0(1)1 { replace weight_w = weight * ratio_total_agemis_`s's_`u'u if sample6y==1 & age_group==. & sex==`s' & urban==`u' } } forvalues a = 1(1)4 { forvalues s = 0(1)1 { replace weight_w = weight * ratio_total_urbmis_`a'a_`s's if sample6y==1 & age_group==`a' & sex==`s' & urban==. } } sort hv001 hv002 hhid save "Dominican Republic_MPI2_2013_final_w.dta", replace * OPEN DATA WITH NEW WEIGHT FOR HH USED IN NEW MPI (CORRECTS FOR THE EXCLUSION OF HHs WITHOUT ELIGIBLE POP) ** ADAPTED BY CECILIA ON AUGUST 5 2013 ** ** Dominican Republic 2013 ** clear set more off set maxvar 10000 set mem 500m cap log close *** Replace here your path to the dataset*** cd "C:\Users\cecilia.calderon\HDRO_MCC\MPI\MPI_new calculations\Dominican 2013_DHS\" *** Replace here the name of your dataset*** capture log close log using "M0_dofile_Dominican Republic2013_MPI2_w.log", text replace use "Dominican Republic_MPI2_2013_final_w.dta", clear capture drop ls-uno ********************************************************************************* ******* Define the deprivation matrix **************************************** ********************************************************************************* *** The dataset can be interpreted as the matrix of achivemnts *** We will now crate the deprivation matrix based on the indicator definition; and deprivation cut-off defined by you *** during the last working session on the normative Issues in Multidimensional Poverty Measure *** In order to do this, we will generate a new variable for each indicator contained in our measure *** This will identify with 0 individuals or households who are not deprived in the specific indicator *** and identify with 1 individual deprived in the specific indicator. *** Note that you will need to replace with dot "." if the information is missing or inconsistent. *** We will assess later the frequency of missing values. ** DEPRIVED IN DRINKING WATER ** (the individual -HH- is considered deprived in drinking water is: unprotected well, spring, river/lake/pond or other) /*lookfor water codebook b2q12, tab(20) gen d_dwater=(b2q12==5 | b2q12==6 | b2q12==7 | b2q12==8) replace d_dwater=. if b2q12==. tab b2q12 d_dwater [aw=weight], miss label variable d_dwater "Deprived in drinking water"ic*/ ** Please follow the same logic for all indicators. ** Note that for advance indicator you may have to use more complex algorithms ***************************************************************************** ******** Create a local variable with all your indicators ********* ***************************************************************************** local varlist_pov electricity_depriv sanitation_depriv water_depriv floor_depriv cookingfuel_depriv asset_depriv educ_depriv child_noattendhh undernutritionhh mortality5hh ***************************************************************************** **** Define the weights ***************************** ***************************************************************************** ** Create a loop for the variables with the same weight ********************* ***************************************************************************** egen ls=rowmiss(electricity_depriv sanitation_depriv water_depriv floor_depriv cookingfuel_depriv asset_depriv) gen hh_missing=0 replace hh_missing=1 if educ_depriv==. | nutrihh==2 | attehh==2 | morthh==2 | (ls>0 & ls<.) foreach var in electricity_depriv sanitation_depriv water_depriv floor_depriv cookingfuel_depriv asset_depriv { gen w_`var'=1/18 if ls==0 } gen w_mortality5hh = 1/6 if morthh==1 & nutrihh==1 replace w_mortality5hh = 1/3 if morthh==1 & nutrihh==3 replace w_mortality5hh = 0 if morthh==3 & nutrihh==1 gen w_undernutritionhh = 1/6 if morthh==1 & nutrihh==1 replace w_undernutritionhh = 1/3 if morthh==3 & nutrihh==1 replace w_undernutritionhh = 0 if morthh==1 & nutrihh==3 gen w_child_noattendhh = 1/6 if attehh==1 | attehh==3 gen w_educ_depriv = 1/6 if educ_depriv<. ******************************************************************* ********* Define the weigthed deprivation g0* matrix **** ******************************************************************* foreach var in `varlist_pov' { gen wg0_`var' = `var'*w_`var' } ****************************************************************************** *********** Compute the frequency of missing values for indicator ************ ****************************************************************************** foreach var in `varlist_pov' { gen `var'_miss=1 if `var'==. replace `var'_miss=0 if `var'!=. } sum *_miss ******************************************************************************** ************* Define the (weighted) deprivation count vector "ci" ************ ******************************************************************************** egen ci=rsum(wg0_*) label variable ci "Deprivation Count" egen n_missing=rowmiss(wg0_*) label variable n_missing "Number of missing variables by individual" gen missing=(n_missing>0) label variable missing "Individual with missing variables" *** Check sample drop due to missing values tab missing ******************************************************************************* ***** Create de identification vector (poor/non poor) ************************* ***** and compute individual average of deprivation *************************** ******************************************************************************* forvalues x=1(1)10 { gen h_`x'0p=(ci>=`x'/10) replace h_`x'0p=. if missing==1 gen a_`x'0p=(ci) if h_`x'0p==1 replace a_`x'0p=. if missing==1 label var h_`x'0p "Condition of Multidimensional Poverty k=`x'" label var a_`x'0p "Individual Average deprivation k=`x'" } sum h_10p-a_100p [aw=weight_w] gen h_33p=(ci>=3.33/10) replace h_33p=. if missing==1 gen a_33p=(ci) if h_33p==1 replace a_33p=. if missing==1 label var h_33p "Condition of Multidimensional Poverty k=33.3" label var a_33p "Individual Average deprivation k=33.3" sum h_33p a_33p [aw=weight_w] ******************************************************************************** ******* Compute raw headcounts ****************************************** ******************************************************************************** foreach var in `varlist_pov' { gen `var'_raw=(`var') replace `var'_raw=. if missing==1 } su *_raw [iw=weight_w] ****************************************************************************** *********** Compute Censored headcount and censored headocunt **************** ****************************************************************************** ***** Please define in the first line your poverty cutoff, the example shows k=33.3 is 33.3% local k=1/3 foreach var in `varlist_pov' { *gen `var'_CH_`k'=(`var'==1 & h_`k'==1) *replace `var'_CH_`k'=. if missing==1 gen `var'_CH_33=(`var'==1 & h_33==1) replace `var'_CH_33=. if missing==1 } sum electricity_depriv_CH_33-educ_depriv_CH_33 [iw=weight_w] sum h_33 a_33 [iw=weight_w] *h = HC *a = intensity capture drop cedu chealth cls scalar drop _all gen cedu = (child_noattendhh_CH_33 * w_child_noattendhh) + (educ_depriv_CH_33 * w_educ_depriv) sum cedu [iw=weight_w] scalar mpi_edu=r(mean) gen chealth = (mortality5hh_CH_33 * w_mortality5hh) + (undernutritionhh_CH_33 * w_undernutritionhh) sum chealth [iw=weight_w] scalar mpi_health=r(mean) gen cls = (electricity_depriv_CH_33 * w_electricity_depriv) + (sanitation_depriv_CH_33 * w_sanitation_depriv) + (water_depriv_CH_33 * w_water_depriv) + (floor_depriv_CH_33 * w_floor_depriv) + (cookingfuel_depriv_CH_33 * w_cookingfuel_depriv) + (asset_depriv_CH_33 * w_asset_depriv) sum cls [iw=weight_w] scalar mpi_ls=r(mean) sum a_33p [iw=weight_w] scalar intensity = r(mean) sum h_33p [iw=weight_w] scalar headcount = r(mean) scalar mpi=headcount*intensity scalar headcount100=headcount*100 scalar intensity100=intensity*100 scalar edu_contrib = (mpi_edu/mpi)*100 scalar health_contrib = (mpi_health/mpi)*100 scalar ls_contrib = (mpi_ls/mpi)*100 capture drop uno gen uno=1 if h_33p<. sum uno [aw=weight_w] if h_33p<. scalar pop=r(sum_w) sum uno [aw=weight_w] if h_33p<. & ci>0 & ci<(1/3) scalar pop_vuln0=r(sum_w) sum uno [aw=weight_w] if h_33p<. & ci>=0.2 & ci<(1/3) scalar pop_vuln20=r(sum_w) sum uno [aw=weight_w] if h_33p<. & ci>=0.5 scalar pop_severe=r(sum_w) scalar vulnerable0=(pop_vuln0/pop)*100 scalar vulnerable20=(pop_vuln20/pop)*100 scalar severity=(pop_severe/pop)*100 * Sample size * HHs capture drop hh egen hh=group(hv001 hv002) sort age bys hh: gen n=_n gen nhh=1 if n==1 * Individuals capture drop uno gen uno=1 sum uno scalar ind_sample_tot=r(N) sum uno if h_33p<. scalar ind_sample_used=r(N) sum uno [w=weight_w] if h_33p<. scalar ind_sample_used_w=r(sum) sum nhh scalar hh_sample_tot=r(N) sum nhh if h_33p<. scalar hh_sample_used=r(N) sort hv001 hv002 hvidx sum nhh [w=weight_w] if h_33p<. scalar hh_sample_used_w=r(sum) * Inequality sum a_33p [aw=weight_w] scalar cv_ineq_poor = r(sd)/r(mean) sum ci [aw=weight_w] if h_33p<. scalar cv_ineq_hc = r(sd)/r(mean) sum ci [aw=weight_w] if h_33p<. & ci>0 scalar cv_ineq_positive = r(sd)/r(mean) * CONTRIBUTION OF EACH DIMENSION FOR THE VULNERABLE POEPLE capture drop *vu foreach var in `varlist_pov' { gen `var'_CH_33vu=0 if h_33p<. & ci>=0.2 & ci<(1/3) replace `var'_CH_33vu=1 if `var'==1 & h_33p<. & ci>=0.2 & ci<(1/3) replace `var'_CH_33vu=. if missing==1 } gen ceduvu = (child_noattendhh_CH_33vu * w_child_noattendhh) + (educ_depriv_CH_33vu * w_educ_depriv) sum ceduvu [iw=weight_w] if h_33p<. & ci>=0.2 & ci<(1/3) scalar mpi_eduvu=r(mean) gen chealthvu = (mortality5hh_CH_33vu * w_mortality5hh) + (undernutritionhh_CH_33vu * w_undernutritionhh) sum chealthvu [iw=weight_w] if h_33p<. & ci>=0.2 & ci<(1/3) scalar mpi_healthvu=r(mean) gen clsvu = (asset_depriv_CH_33vu * w_asset_depriv) + (electricity_depriv_CH_33vu * w_electricity_depriv) + (sanitation_depriv_CH_33vu * w_sanitation_depriv) + (water_depriv_CH_33vu * w_water_depriv) + (floor_depriv_CH_33vu * w_floor_depriv) + (cookingfuel_depriv_CH_33vu * w_cookingfuel_depriv) sum clsvu [iw=weight_w] if h_33p<. & ci>=0.2 & ci<(1/3) scalar mpi_lsvu=r(mean) sum ci [iw=weight_w] if h_33p<. & ci>=0.2 & ci<(1/3) scalar headcountvu = r(mean) scalar headcountvu100=headcountvu*100 scalar edu_contribvu = (mpi_eduvu/headcountvu100)*10000 scalar health_contribvu = (mpi_healthvu/headcountvu100)*10000 scalar ls_contribvu = (mpi_lsvu/headcountvu100)*10000 * CONTRIBUTION OF EACH DIMENSION FOR THE VULNERABLE + POOR POEPLE (ci >= 0.2) capture drop *vupo foreach var in `varlist_pov' { gen `var'_CH_33vupo=0 if h_33p<. & ci>=0.2 & ci<. replace `var'_CH_33vupo=1 if `var'==1 & h_33p<. & ci>=0.2 & ci<. replace `var'_CH_33vupo=. if missing==1 } gen ceduvupo = (child_noattendhh_CH_33vupo * w_child_noattendhh) + (educ_depriv_CH_33vupo * w_educ_depriv) sum ceduvupo [iw=weight_w] if h_33p<. & ci>=0.2 & ci<. scalar mpi_eduvupo=r(mean) gen chealthvupo = (mortality5hh_CH_33vupo * w_mortality5hh) + (undernutritionhh_CH_33vupo * w_undernutritionhh) sum chealthvupo [iw=weight_w] if h_33p<. & ci>=0.2 & ci<. scalar mpi_healthvupo=r(mean) gen clsvupo = (asset_depriv_CH_33vupo * w_asset_depriv) + (electricity_depriv_CH_33vupo * w_electricity_depriv) + (sanitation_depriv_CH_33vupo * w_sanitation_depriv) + (water_depriv_CH_33vupo * w_water_depriv) + (floor_depriv_CH_33vupo * w_floor_depriv) + (cookingfuel_depriv_CH_33vupo * w_cookingfuel_depriv) sum clsvupo [iw=weight_w] if h_33p<. & ci>=0.2 & ci<. scalar mpi_lsvupo=r(mean) sum ci [iw=weight_w] if h_33p<. & ci>=0.2 & ci<. scalar headcountvupo = r(mean) scalar headcountvupo100=headcountvupo*100 scalar edu_contribvupo = (mpi_eduvupo/headcountvupo100)*10000 scalar health_contribvupo = (mpi_healthvupo/headcountvupo100)*10000 scalar ls_contribvupo = (mpi_lsvupo/headcountvupo100)*10000 scalar list mpi headcount100 intensity100 vulnerable0 vulnerable20 severity edu_contrib health_contrib ls_contrib edu_contribvu health_contribvu ls_contribvu edu_contribvupo health_contribvupo ls_contribvupo cv_ineq_poor cv_ineq_positive cv_ineq_hc hh_sample_tot hh_sample_used hh_sample_used_w ind_sample_tot ind_sample_used ind_sample_used_w sum sample_all [w=weight] scalar sall = r(sum) sum sample6y [w=weight_w] scalar smpi = r(sum) scalar list sall smpi ************************************ ** ALWAYS CHECK THAT sall = smpi ** ************************************