*********************************************************************************************************************** ** Human Development Report Office (HDRO), United Nations Development Programme ** Multidimensional Poverty Index 2023 release ** Methodology developed in partnership with the Oxford Poverty and Human Development Initiative, University of Oxford ************************************************************************************************************************ clear all set more off set maxvar 10000 set mem 500m cap log close *working folder path*** global path_in "C:\UNDP\MPI\MPI_Computation\MPI_2023\NationalSurveys\Mozambique_2019-20" global path_out "C:\UNDP\MPI\MPI_Computation\MPI_2023\NationalSurveys\Mozambique_2019-20" global path_logs "C:\UNDP\MPI\MPI_Computation\MPI_2023\NationalSurveys\Mozambique_2019-20" global path_qc "C:\UNDP\MPI\MPI_Computation\MPI_2023\NationalSurveys\Mozambique_2019-20" global path_ado "C:" *** Log file *** log using "$path_logs/Mozambique_2019-20_dataprep.log", replace ******************************************************************************** *** Mozambique National Survey IOF 2019-20 *** ******************************************************************************** ******************************************************************************** *** Step 1: Data preparation *** Selecting variables from the nutrition, habitat, asset datasets & merge with individual member dataset ******************************************************************************** /*In Mozambique IOF 2019-20, height and weight measurements were collected from children (0-5 years old).*/ ******************************************************************************** *** Step 1.1 CHILDREN's RECODE (under 5) ******************************************************************************** use "$path_in/Antropometria.dta", clear rename _all, lower *Checking unique set of identifiable variables ***Cluster ID= iof_id ***Family aggregate= agreg_familiar ***Interview Key ID=interview__key ***Member line number= numero_linha_membro duplicates report iof_id agreg_familiar numero_linha_membro //The variable set does not uniquely identify the individuals *Trying with Interview Key variable instead of agreg_familiar duplicates report iof_id interview__key numero_linha_membro /*No duplication observed and the variable set uniquely identifies the sample. We will consider these variables for merging with other datasets. It seems "interview__key" variable captures the household ID in the survey dataset*/ gen child_KR=1 //Generate identification variable for observations in the under-five nutrition dataset /*The nutrition dataset does not have the sex variable, so we need to extract this information from the "individual" dataset. We need to merge child's nutrition dataset with the "individual" dataset.*/ *Renaming variable names to allign with Individual member dataset rename interview__key interview_key rename numero_linha_membro r_mp__id count //Total of 9638 samples in the nutrition dataset merge 1:1 iof_id interview_key r_mp__id using "$path_in/7_Membros - Individual Questions.dta" keep if _merge==3 //Omitting samples without nutrition information keep iof_id interview_key weight_ajust_proj interview__id cod_provincia provincia cod_distrito distrito urbano_rural r_mp__id agreg_familiar data_entrevista dia mes ano pa34 dia_a mes_a ano_a data_nascimento pa34a idade_meses pa35 pmin pmax pa36 amin amax pa37 pa_37a pa38 pa39 child_KR af05_idade af04_sexo //Only keeping relevant variables *** Next, indicate to STATA where the igrowup_restricted.ado file is stored: ***Source of ado file: http://www.who.int/childgrowth/software/en/ adopath + "C:\UNDP\MPI\WHO igrowup STATA\" *** We will now proceed to create three nutritional variables: *** weight-for-age (underweight), *** weight-for-height (wasting) *** height-for-age (stunting) /* We use 'reflib' to specify the package directory where the .dta files containing the WHO Child Growth Standards are stored. Note that we use strX to specify the length of the path in string. If the path is long, you may specify str55 or more, so it will run. */ gen str100 reflib="C:\UNDP\MPI\WHO igrowup STATA\" lab var reflib "Directory of reference tables" /* We use datalib to specify the working directory where the input STATA dataset containing the anthropometric measurement is stored. */ gen str100 datalib = "$path_out" lab var datalib "Directory for datafiles" /* We use datalab to specify the name that will prefix the output files that will be produced from using this ado file (datalab_z_r_rc and datalab_prev_rc)*/ gen str30 datalab = "children_nutri_Mozambique" lab var datalab "Working file" *** Next check the variables that WHO ado needs to calculate the z-scores: *** sex, age, weight, height *** Variable: SEX *** tab af04_sexo, miss tab af04_sexo, nol //"1" for male ;"2" for female clonevar gender = af04_sexo desc gender tab gender *** Variable: AGE *** *Date of birth tab1 ano_a mes_a dia_a, m *Recoding as missing replace ano_a=. if ano_a>9000 replace mes_a=. if mes_a>90 replace dia_a=. if dia_a>90 *Generating birthday gen bdate=mdy(mes_a, dia_a, ano_a) *Date of interview tab1 dia mes ano, m des dia mes ano *Generating interview date destring dia, gen(dia_m) destring mes , gen(mes_m) destring ano, gen(ano_m) gen mdate=mdy(mes_m, dia_m, ano_m) gen age_months = (mdate-bdate)/30.4375 gen age_test=trunc(age) *Age in month provided in the dataset tab idade_meses, miss codebook idade_meses //idade_meses= Age in months //Age is measured in months clonevar age = idade_meses desc age summ age replace age=. if age_months<0 //Recoding irrational age_month values as missing, 2 negative observations changed to missing. gen str6 ageunit = "months" lab var ageunit "Months" compare age_months age /*We will use the age_months variable calculated from the date of birth and interview for further computation */ drop age_test age *** Variable: BODY WEIGHT (KILOGRAMS) *** codebook pa35, tab (10000) gen weight = pa35 desc weight tab weight sum weight *** Variable: HEIGHT (CENTIMETERS) codebook pa36, tab (10000) gen height = pa36 //We divide it by 10 in order to express it in centimeters tab pa36 if pa36>9990,m nol //Missing values are 9994 to 9996 replace height = . if pa36>=9990 //All missing values or out of range are replaced as "." tab height if height>500 *replace height=. if height>500 /*There are observations (n=12) where the height is recorded larger than 500 cm, which is clearly an error. We don't make any change at this stage since these observations would be excluded at the stage of z-score computation with WHO program.*/ desc height tab height sum height *** Variable: MEASURED STANDING/LYING DOWN *** codebook pa37 tab pa37, m //Height measurement position missing for a considerable proportion of sample children (n=1491) gen measure = "l" if pa37==1 //Child measured lying down replace measure = "h" if pa37==2 //Child measured standing up replace measure = " " if pa37==3 //Replace with " " if coded as absent /*For children with height measurement position missing, we follow the survey guidelines that state child under 2 years old were measured in lying down position and over or equal to 2 years in standing-up position Family budget survey-IOF 2019/20, Nutritional Status of children under 5 years old-Supplementary report, page no. 11. */ replace measure= "l" if pa37==. & age_months<24 replace measure= "h" if pa37==. & age_months>=24 desc measure tab measure, m *** Variable: OEDEMA *** tab pa39, m /*Oedema infomation available in the survey, but almost 1591 children had missing observations. Besides, a substantial proportion of the children, n=6824(70.8%), were categorised as having bilateral edema, which seems to be unnaturally high. WHO recommends that the "oedema measurement is only appropriate in surveys where local experts, specially clinicians or individuals from the ministry of health working at a local level, can clearly indicate if they have seen recent cases where oedema was present". The mozambique IOF was primarily intended for family budget survey, and it is not clear in the report who and how "oedema" information was collected. We proceed to calculate nutritional estimates without using the oedema information.*/ /* gen str1 oedema = "y" if pa39==1 replace oedema = "n" if pa39==2 replace oedema = " " if pa39==. */ gen str1 oedema = "n" //It assumes no-one has oedema desc oedema tab oedema gen sw=weight_ajust_proj des sw sum sw keep iof_id interview_key r_mp__id child_KR reflib datalib datalab gender age_months ageunit dia_a mes_a ano_a weight height measure oedema sw /*We now run the command to calculate the z-scores with the adofile */ igrowup_restricted reflib datalib datalab gender age_months ageunit weight height measure oedema sw /*We now turn to using the dta file that was created and that contains the calculated z-scores to create the child nutrition variables following WHO standards */ use "$path_out/children_nutri_Mozambique_z_rc.dta", clear *** Standard MPI indicator *** //Takes value 1 if the child is under 2 stdev below the median & 0 otherwise gen underweight = (_zwei < -2.0) replace underweight = . if _zwei == . | _fwei==1 lab var underweight "Child is undernourished (weight-for-age) 2sd - WHO" tab underweight [aw=sw], miss gen stunting = (_zlen < -2.0) replace stunting = . if _zlen == . | _flen==1 lab var stunting "Child is stunted (length/height-for-age) 2sd - WHO" tab stunting [aw=sw], miss gen wasting = (_zwfl < - 2.0) replace wasting = . if _zwfl == . | _fwfl == 1 lab var wasting "Child is wasted (weight-for-length/height) 2sd - WHO" tab wasting [aw=sw], miss tab underweight [aw=sw] tab stunting [aw=sw] tab wasting [aw=sw] //Retain relevant variables: keep iof_id interview_key r_mp__id child_KR underweight stunting wasting order iof_id interview_key r_mp__id child_KR underweight stunting wasting sort iof_id interview_key r_mp__id duplicates report iof_id interview_key r_mp__id //Erase files from folder: erase "$path_out/children_nutri_Mozambique_z_rc.xls" erase "$path_out/children_nutri_Mozambique_prev_rc.xls" *erase "$path_out/children_nutri_Mozambique_z_rc.dta" //Save a temp file for merging with PR: save "$path_out/mozambique_KR.dta", replace ******************************************************************************** *** Step 1.2 Household recode ******************************************************************************** use "$path_in/6_Habitacao.dta", clear duplicates report iof_id interview_key //All values are uniquely defined, no duplicate observed. gen HH_Data=1 tab interview__status tab resultadodaentrevista_afoutro *Keeping relevant variables keep iof_id interview_key HH_Data af33 af33_especifique af34_minutos af37 af38 af39 af40 af40_especifique af41 af41_especifique af48 af48_especifique af49 af50 af50_especifique /// interview__status resultadodaentrevista_afoutro sort iof_id interview_key save "$path_out/HH_recode.dta", replace ******************************************************************************** *** Step 1.3 Household assets recode ******************************************************************************** use "$path_in/3_Bens Duraveis_FINAL", clear /*The asset information is arranged in the long format, where each asset for the given household is listed in a row. We need to convert to the wide format to merge with the other dataset.*/ rename interview__key interview_key duplicates report iof_id interview_key //All households are uniquely identified, n=13113 *Counting total household number in the dataset egen hh_num=group( iof_id interview_key) sum hh_num //Total household# in the dataset is 13113 *Generating variable to count asset number within the household by interview_key, sort: gen hh_asset=_n *Keeping only necessary variables keep iof_id interview_key interview__id cod_provincia cod_distrito urbano_rural agreg_familiar r_bens_duraveis__id hh_num hh_asset weight *Relabeling r_bens_duraveis__id variable label define r_bens_duraveis__id 51113 "Chairs" 51114 "beds and bunk beds" 51117 "tables" 53111 "Glacier" /// 53112 "Freezer" 53121 "Washing machines (includes dryer)" 53131 "Charcoal and/or wood stoves" 53132 "gas stoves" /// 53133 "electric stoves" 53134 "Mixed stoves (electric and gas)" 53138 "microwave" 53144 "air conditioners" /// 53146 "Fans / Fans" 53161 "Electric sewing machines" 53162 "Non-electric sewing machines" /// 53203 "Electric irons for ironing clothes" 55102 "electric pump" 55103 "Chainsaw" 55201 "machetes" /// 71110 "new car vehicles" 71120 "used car vehicles" 71201 "motorcycles" 71301 "Bicycle" /// 71400 "Donkey carts, ox for transportation" 82001 "Fixed network telephone box" 82004 "cell phones" /// 91112 "sound systems" 91113 "radio" 91121 "Televisions" 91211 "Filming and/or photographing machine" /// 91305 "Printers" 123103 "Wall, wrist and pocket clocks" 5404801 "Charcoal iron" 5510401 "Generator" /// 5510402 "Solar panel" 5520201 "wheelbarrow" 5520202 "axes" 5520203 "scythes" 5520204 "hoes" /// 9130301 "Computers (including keyboard, mouse," 9130302 "Laptop (portable computer)" 28210200 "Tractor" /// 28210311 "Plow" 28210411 "thresher" 30110501 "Sailing fishing boats" 30110502 "Canoe" 32300520 "Fishing net" label values r_bens_duraveis__id r_bens_duraveis__id *Reshaping the data in the wide format reshape wide r_bens_duraveis__id, i(interview_key) j(hh_asset) /*Dataset in the long format didn't mark all assets variables, i.e. only assets reported by household were listed in the dataset, we now need to count each asset using the loop function in the wide dataset as shown below */ *Checking number of assets per household gen asst_num=0 foreach var of varlist r_bens_duraveis__id1-r_bens_duraveis__id34 { replace asst_num=asst_num+1 if `var'!=. } //All 13,113 households had atleast one asset in the dataset *First, we generate relevant asset variables. gen television =0 gen radio = 0 gen telephone = 0 gen mobiletelephone = 0 gen refrigerator = 0 gen glacier=0 gen newcar = 0 gen oldcar=0 gen tractor=0 gen bicycle = 0 gen motorbike = 0 gen computer = 0 gen laptop=0 gen animal_cart = 0 *We creat a loop to count each assest within a household. foreach var of varlist r_bens_duraveis__id1-r_bens_duraveis__id34 { replace television=1 if `var'==91121 replace radio=1 if `var'==91113 replace telephone=1 if `var'==82001 replace mobiletelephone =1 if `var'== 82004 replace refrigerator =1 if `var'== 53112 replace glacier =1 if `var'== 53111 replace newcar =1 if `var'== 71110 replace oldcar =1 if `var'== 71120 replace tractor=1 if `var'== 28210200 replace bicycle = 1 if `var'==71301 replace motorbike = 1 if `var'== 71201 replace computer = 1 if `var'==9130301 replace laptop=1 if `var'==9130302 replace animal_cart = 1 if `var'==71400 } tab1 television radio telephone mobiletelephone refrigerator glacier /// newcar oldcar tractor bicycle motorbike computer laptop animal_cart [iweight=weight], miss gen HH_asset=1 *keeping only relevant variables keep iof_id interview_key interview__id HH_asset agreg_familiar television radio telephone mobiletelephone /// refrigerator glacier newcar oldcar tractor bicycle motorbike computer laptop animal_cart sort iof_id interview_key interview__id save "$path_out/HHAsset_recode.dta", replace ******************************************************************************** *** Step 1.4 HH member recode ******************************************************************************** use "$path_in/7_Membros - Individual Questions.dta" rename _all, lower gen country = "Mozambique" gen countrycode = "MOZ" gen year = "2019-20" gen survey = "National" *** Household unique id encode interview_key, gen(hh_id) lab var hh_id "Household ID" bys hh_id: gen id=_n count if id==1 //13,348 households ****Translating variable labels/codes *Sex tab af04_sexo, miss label define sex 1"Man" 2"Female", modify label values af04_sexo sex tab af04_sexo, miss //No sex label provided in the stata dataset, labelled variable referenced to questionnaire *Slept elsewhere in the past 3 months tab af06b, miss label define YesNo 1"Yes" 2"No", modify label values af06b YesNo tab af06b, miss *Marital status tab af07, miss label define marital 1"Single" 2"Married" 3"Marital Union" 4"Divorsed/Seperated" 5"Widowed", modify label values af07 marital tab af07, miss *Biological mother tab af08, miss label define YesNoDont 1"Yes" 2"No" 8"Don't know", modify label values af08 YesNoDont tab af08, miss *Biological mother lives in the house tab af9a, miss label values af9a YesNo tab af9a, miss *Biological father tab af10,miss label values af10 YesNoDont tab af10,miss *Biological father lives in the house tab af11a, miss label values af11a YesNo tab af11a, miss *Education *read and write tab af12, miss label values af12 YesNoDont tab af12, miss *Ever attend school tab af13, miss label values af13 YesNo tab af13, miss *Reason for not attending school tab af13a, miss *Highest level of education attended tab af14_nivel,miss *Highest level of education completed tab af14a_nivel,miss *Highest grade/year completed at this level tab af14_classe, miss label define highestgrade 0"No class/year" 1"1st class" 2"2nd class" 3"3rd class" 4"4th class" 5"5th class" 6"6th class" /// 7"7th class" 8"8th class" 9"9th class" 10"10th class" 11"11th class" 12"12th class" 13"1st year" 14"2nd year" 15"3rd year" /// 16 "4th year" 17"5th year" 18"6th year" 19"7th year" 98 "Don't know", modify label values af14_classe highestgrade //Option 19 assumed to be 7th year (code not defined in the questionnaire) *Currently studying/enrolled tab af15, miss label values af15 YesNo tab af15, miss *Current academic level tab af15a_nivel, miss *Highest class/year/grade at the current academic level tab af15a_classe, miss label values af15a_classe highestgrade sort iof_id interview_key r_mp__id ******************************************************************************** *** 1.5 DATA MERGING ******************************************************************************** ***merging with KR (Under-five children) dataset ************************************************* merge 1:1 iof_id interview_key r_mp__id using "$path_out/mozambique_KR.dta" drop _merge erase "$path_out/mozambique_KR.dta" ***merging with Household recode dataset ************************************************* merge m:1 iof_id interview_key using "$path_out/HH_recode.dta" //15 observations from 5 HHs not matched in the master dataset; all observations merged from the using dataset drop _merge erase "$path_out/HH_recode.dta" ***merging with Household asset dataset ************************************************* merge m:1 iof_id interview_key using "$path_out/HHAsset_recode.dta" egen testhh_num=group(iof_id interview_key) if _merge==1 //994 samples from 235 HHs not matched in the master dataset; all observations merged from the using dataset drop _merge testhh_num erase "$path_out/HHAsset_recode.dta" ******************************************************************************** *** 1.6 RENAMING DEMOGRAPHIC VARIABLES *** ******************************************************************************** //Sample weight lookfor weight //"ponde_f" as the household member weight clonevar weight=weight_ajust_proj label var weight "Individual sample weight" //Area: Urban or rural lookfor urban /*"urbano_rural" variable named as the urban/rural stratum. No label coded in the "individual" dataset, So we assume the same label as in the Habitacao dataset, 1-Urban and 2-Rural, but need to verify. */ clonevar area=urbano_rural codebook area replace area=0 if area==2 label define lab_area 1 "urban" 0 "rural" label values area lab_area label var area "Area: urban-rural" tab area urbano_rural, miss nol //Sex of household member lookfor sex //"af04_sexo" as the gender variable: 1- Man and 2- Women clonevar sex=af04_sexo label define sex 1"Male" 2"Female", modify label values sex sex label var sex "Sex of household member" tab sex, m //Age of household member lookfor age //"af05_idade " as the age in years clonevar age=af05_idade tab age, m label var age "Age of household member" //Age group recode age (0/4 = 1 "0-4")(5/9 = 2 "5-9")(10/14 = 3 "10-14") /// (15/17 = 4 "15-17")(18/59 = 5 "18-59")(60/max=6 "60+"), gen(agec7) lab var agec7 "age groups (7 groups)" recode age (0/9 = 1 "0-9") (10/17 = 2 "10-17")(18/59 = 3 "18-59") /// (60/max=4 "60+"), gen(agec4) lab var agec4 "age groups (4 groups)" //Marital status of household member /*"af07" as the marital status. As the variable was not coded, we retrieved the information from the survey questionnaire where the variable is coded as 1-Single, 2-Married, 3-Marital Union, 4-Divorsed/seprated, 5-Widowed" */ clonevar marital = af07 codebook marital, tab (20) recode marital (1=1)(3=2)(5=3)(4=4) label define lab_mar 1"never married" 2"currently married" /// 3"widowed" 4"divorced" 5"not living together" label values marital lab_mar label var marital "Marital status of household member" tab af07 marital, miss //Total number of de jure hh members in the household *Assuming that there is no "de jure" identifier variable in the dataset. *This variable was not identified in the dataset (needs to be confirmed). gen member = 1 bysort hh_id: egen hhsize = sum(member) label var hhsize "Household size" tab hhsize, miss drop member //Subnational region tab provincia /*Variable "provincia" contains information about the province*/ clonevar region=provincia tab region, m lab var region "Region for subnational decomposition" ******************************************************************************** *** 1.7 CONTROL VARIABLES ******************************************************************************** /* Households are identified as having 'no eligible' members if there are no applicable population, that is, children 0-5 years, adult women 15-49 years or men 15-59 years. These households will not have information on relevant indicators of health. As such, these households are considered as non-deprived in those relevant indicators.*/ /*The Mozambique datasets do not contain eligibility criteria variables, so we will construct eligibility variable based on the participant's age */ count if age<=4 tab age child_KR, miss tab age child_KR if age<5, miss //About 194 under five children not included in the child_KR dataset //We only have age informaton with year as the unit. *** No eligible children 0-4 years **************************************** gen child_eligible = (age>=0 & age<=4) bys hh_id: egen hh_n_children_eligible = sum(child_eligible) //Number of eligible children for anthropometrics gen no_child_eligible = (hh_n_children_eligible==0) //Takes value 1 if there were no eligible children for anthropometrics lab var no_child_eligible "Household has no children aged 0-4 years eligible" tab no_child_eligible, miss ******************************************************************************** *** Step 2 Data preparation *** *** Standardization of the 10 Global MPI indicators *** Identification of non-deprived & deprived individuals ******************************************************************************** ******************************************************************************** *** Step 2.1 Years of Schooling *** ******************************************************************************** ** official entrance age for primary = 6 yrs ** duration of primary = 7 yrs **OE age for lower secondary=13 years **duration of lower secondary=3 yrs **OE age for upper secondary=16 years **duration of upper secondary=2 yrs *Constructing the highest completed grade/school/school year variable *Highest level of education attended tab af14_nivel tab af14_nivel, nol *Highest level of education completed tab af14a_nivel tab af14a_nivel,nol //We will use the highest level of education attended for the further computation. * Highest grade/years individual has completed at the given education level tab af14_classe tab af14_classe, nol tab af14_nivel af14_classe, miss gen eduyears=. replace eduyears=0 if af13==2 //Never attended school //Recoding preschool and literacy as grade zero irrespective of the edu level and edu grade/year replace eduyears=0 if af14_nivel==1|af14_nivel==2 //Recoding the first cycle primary (Grade/school/year 0-5) replace eduyears=0 if af14_nivel==3 & af14_classe==0 replace eduyears=1 if af14_nivel==3 & af14_classe==1 replace eduyears=2 if af14_nivel==3 & af14_classe==2 replace eduyears=3 if af14_nivel==3 & af14_classe==3 replace eduyears=4 if af14_nivel==3 & af14_classe==4 replace eduyears=5 if af14_nivel==3 & af14_classe==5 //Recoding the second cycle primary (Grade/school/year 5-7) replace eduyears=5 if af14_nivel==4 & af14_classe==0 replace eduyears=6 if af14_nivel==4 & af14_classe==6 replace eduyears=7 if af14_nivel==4 & af14_classe==7 //Recoding the secondary 1st cycle (Grade/school/year 7-10) replace eduyears=7 if af14_nivel==5 & af14_classe==0 replace eduyears=8 if af14_nivel==5 & af14_classe==8 replace eduyears=9 if af14_nivel==5 & af14_classe==9 replace eduyears=10 if af14_nivel==5 & af14_classe==10 //Recoding the Secondary 2nd cycle (Grade/school/year 10-12) replace eduyears=10 if af14_nivel==6 & af14_classe==0 replace eduyears=11 if af14_nivel==6 & af14_classe==11 replace eduyears=12 if af14_nivel==6 & af14_classe==12 //Recoding all technical courses (Elementary/Basic/Technical) and primary teacher training as post secondary 1st cycle replace eduyears=10 if (af14_nivel==7|af14_nivel==8|af14_nivel==9| af14_nivel==10) & (af14_classe==0) replace eduyears=11 if (af14_nivel==7|af14_nivel==8|af14_nivel==9| af14_nivel==10) & (af14_classe==13) replace eduyears=12 if (af14_nivel==7|af14_nivel==8|af14_nivel==9| af14_nivel==10) & (af14_classe==14) replace eduyears=13 if (af14_nivel==7|af14_nivel==8|af14_nivel==9| af14_nivel==10) & (af14_classe==15) replace eduyears=14 if (af14_nivel==7|af14_nivel==8|af14_nivel==9| af14_nivel==10) & (af14_classe==16) //Recoding Bachelor's degree and graduation education level as the post secondary 2nd cycle replace eduyears=12 if (af14_nivel==11 | af14_nivel==12) & (af14_classe==0) replace eduyears=13 if (af14_nivel==11 | af14_nivel==12) & (af14_classe==13) replace eduyears=14 if (af14_nivel==11 | af14_nivel==12) & (af14_classe==14) replace eduyears=15 if (af14_nivel==11 | af14_nivel==12) & (af14_classe==15) replace eduyears=16 if (af14_nivel==11 | af14_nivel==12) & (af14_classe==16) replace eduyears=17 if (af14_nivel==11 | af14_nivel==12) & (af14_classe==17) replace eduyears=18 if (af14_nivel==11 | af14_nivel==12) & (af14_classe==18) replace eduyears=19 if (af14_nivel==11 | af14_nivel==12) & (af14_classe==19) //Recoding master's level education replace eduyears=16 if (af14_nivel==13) & (af14_classe==0) replace eduyears=17 if (af14_nivel==13) & (af14_classe==13) replace eduyears=18 if (af14_nivel==13) & (af14_classe==14) //Recoding the phd education replace eduyears=19 if (af14_nivel==14) & (af14_classe==13) replace eduyears=20 if (af14_nivel==14) & (af14_classe==14) replace eduyears=21 if (af14_nivel==14) & (af14_classe>=15 & af14_class<=19 ) lab var eduyears "Highest year of education completed" tab eduyears af14_nivel, miss tab eduyears af14_classe, miss replace eduyears=0 if (af14_nivel==3 & af14_classe>5) //// Coding those in lower primary with missing grade as eduyears=0 *recode any unreasonable years of highest education as missing value replace eduyears = . if eduyears>=age & age>0 replace eduyears = 0 if age < 10 replace eduyears = 0 if (age==10 | age==11 ) & eduyears < 6 /*The variable "eduyears" was replaced with a '0' given that the criteria for this indicator is household member aged 12 years or older */ replace eduyears=6 if age>=10 & age<. & (af14_nivel>=5 & af14_nivel<=14) & (af14_classe==98 | af14_classe==.) /*Recoding eduyears as 6 years (enought for MPI to be grouped as non-deprived in this indicator) if the highest grade/year is missing or unknown but education level is equal or higher than secondary education*/ replace eduyears=1 if age>=10 & age<. & (af14_nivel==3 & af14_nivel==4) & (af14_classe==98 | af14_classe==.) /*A control variable is created on whether there is information on years of education for at least 2/3 of the household members. */ gen temp = 1 if (eduyears!=. & (age>=12 & age!=.)) | (((age==10 | age==11) & eduyears>=6 & eduyears<.)) bysort hh_id: egen no_missing_edu = sum(temp) /*Total household members who are 12 years and older with no missing years of education but recognizing as an achievement if the member is 10 or 11 and already completed 6 yrs of schooling */ gen temp2 = 1 if (age>=12 & age!=.) | (((age==10 | age==11) & eduyears>=6 & eduyears<.)) bysort hh_id: egen hhs = sum(temp2) //Total number of household members who are 12 years and older replace no_missing_edu = no_missing_edu/hhs replace no_missing_edu = (no_missing_edu>=2/3) /*Identify whether there is information on years of education for at least 2/3 of the household members aged 12 years and older */ tab no_missing_edu, miss label var no_missing_edu "No missing edu for at least 2/3 of the HH members aged 12 years & older" drop temp temp2 hhs /*The entire household is considered deprived if no household member aged 12 years or older has completed SIX years of schooling. */ gen years_edu6 = (eduyears>=6) /* The years of schooling indicator takes a value of "1" if at least someone in the hh has reported 6 years of education or more */ replace years_edu6 = . if eduyears==. bysort hh_id: egen hh_years_edu6_1 = max(years_edu6) gen hh_years_edu6 = (hh_years_edu6_1==1) replace hh_years_edu6 = . if hh_years_edu6_1==. replace hh_years_edu6 = . if hh_years_edu6==0 & no_missing_edu==0 lab var hh_years_edu6 "Household has at least one member with 6 years of edu" tab hh_years_edu6, m ******************************************************************************** *** Step 2.2 Child School Attendance *** ******************************************************************************** codebook af15, tab (10) //Currently enrolled in the school codebook af13, tab (10) //Ever attended school gen attendance = 1 if af15==1 //Replace attendance with '1' if currently attending school replace attendance = 0 if af15==2 //Replace attendance with '0' if currently not attending school replace attendance = 0 if af13==2 //Replace attendance with '0' if never ever attended school *replace attendance = 0 if ed4==1 & ed5a==4 //Replace attendance with '0' if attended school but informal schooling //informal education is not a category in Mozambique tab age af15, miss //Check individuals who are not of school age replace attendance = 0 if age<5 | age>24 //Replace attendance with '0' for individuals who are not of school age tab attendance, miss label define lab_attend 1 "currently attending" 0 "not currently attending" label values attendance lab_attend label var attendance "Attended school during current school year" /*The entire household is considered deprived if any school-aged child is not attending school up to class 8. */ gen child_schoolage = (age>=6 & age<=14) /* Note: In Mozambique, the official school entrance age is 6 years. So, age range is 6-14 (=6+8). Source: "http://data.uis.unesco.org/?ReportId=163" Go to Education>Education>System>Official entrance age to primary education. Look at the starting age and add 8. */ /*A control variable is created on whether there is no information on school attendance for at least 2/3 of the school age children */ count if child_schoolage==1 & attendance==. //Understand how many eligible school aged children are not attending school gen temp = 1 if child_schoolage==1 & attendance!=. bysort hh_id: egen no_missing_atten = sum(temp) /*Total school age children with no missing information on school attendance */ gen temp2 = 1 if child_schoolage==1 bysort hh_id: egen hhs = sum(temp2) //Total number of household members who are of school age replace no_missing_atten = no_missing_atten/hhs replace no_missing_atten = (no_missing_atten>=2/3) /*Identify whether there is missing information on school attendance for more than 2/3 of the school age children */ tab no_missing_atten, miss label var no_missing_atten "No missing school attendance for at least 2/3 of the school aged children" drop temp temp2 hhs bysort hh_id: egen hh_children_schoolage = sum(child_schoolage) replace hh_children_schoolage = (hh_children_schoolage>0) //Control variable: //It takes value 1 if the household has children in school age lab var hh_children_schoolage "Household has children in school age" gen child_not_atten = (attendance==0) if child_schoolage==1 replace child_not_atten = . if attendance==. & child_schoolage==1 bysort hh_id: egen any_child_not_atten = max(child_not_atten) gen hh_child_atten = (any_child_not_atten==0) replace hh_child_atten = . if any_child_not_atten==. replace hh_child_atten = 1 if hh_children_schoolage==0 replace hh_child_atten = . if hh_child_atten==1 & no_missing_atten==0 /*If the household has been intially identified as non-deprived, but has missing school attendance for at least 2/3 of the school aged children, then we replace this household with a value of '.' because there is insufficient information to conclusively conclude that the household is not deprived */ lab var hh_child_atten "Household has all school age children up to class 8 in school" tab hh_child_atten, miss /*Note: The indicator takes value 1 if ALL children in school age are attending school and 0 if there is at least one child not attending. Households with no children receive a value of 1 as non-deprived. The indicator has a missing value only when there are all missing values on children attendance in households that have children in school age. */ ******************************************************************************** *** Step 2.3 Nutrition *** ******************************************************************************** *** Child Underweight Indicator *** ************************************************************************ bysort hh_id: egen temp = max(underweight) gen hh_no_underweight = (temp==0) //Takes value 1 if no child in the hh is underweight replace hh_no_underweight = . if temp==. replace hh_no_underweight = 1 if no_child_eligible==1 /* Households with no eligible children will receive a value of 1 */ lab var hh_no_underweight "Household has no child underweight - 2 stdev" drop temp *** Child Stunting Indicator *** ************************************************************************ bysort hh_id: egen temp = max(stunting) gen hh_no_stunting = (temp==0) //Takes value 1 if no child in the hh is stunted replace hh_no_stunting = . if temp==. replace hh_no_stunting = 1 if no_child_eligible==1 lab var hh_no_stunting "Household has no child stunted - 2 stdev" drop temp *** Child Either Stunted or Underweight Indicator *** ************************************************************************ gen uw_st = 1 if stunting==1 | underweight==1 replace uw_st = 0 if stunting==0 & underweight==0 replace uw_st = . if stunting==. & underweight==. bysort hh_id: egen temp = max(uw_st) gen hh_no_uw_st = (temp==0) //Takes value 1 if no child in the hh is underweight or stunted replace hh_no_uw_st = . if temp==. replace hh_no_uw_st = 1 if no_child_eligible==1 //Households with no eligible children will receive a value of 1 lab var hh_no_uw_st "Household has no child underweight or stunted" drop temp ******************************************************************************** *** Step 2.3c Household Nutrition Indicator *** ******************************************************************************** gen hh_nutrition_uw_st = hh_no_uw_st lab var hh_nutrition_uw_st "Household has no child underweight or stunted" ******************************************************************************** *** Step 2.4 Child Mortality *** ******************************************************************************** gen hh_mortality_5y =. lab var hh_mortality_5y "Household had no child mortality in the last 5 years" //Mozambique survey did not collect household child mortality information. ******************************************************************************** *** Step 2.5 Electricity *** ******************************************************************************** /*Mozambique survey has no direct question on the electricity, but the main source of energy or fuel for lighting. We identified households as not deprived in electricity in their lights are powered by public electricity, generator/solar plate, or Battery, while other sources as deprived. */ tab af41, m clonevar electricity=af41 codebook electricity, tab (100) replace electricity=. if af41==0 | (af41>96 & af41<.) //Recoding error codes as missing replace electricity = 1 if af41==2 /*Coding electricity variable as 1 (non-deprived) if HH has electricity from the public grid or generator/Solar plate.*/ replace electricity = 0 if af41==3 | af41==4| af41==5| af41==6| af41==7| af41==8| af41==96 /*Coding electricity variable as 0 (deprived) if HH source of lighting is gas, petroleum/parafin/kerosene, candle, firewood, battery or Other*/ replace electricity=0 if af41==0 & af41_especifique=="nao usa nenhum meio para iluminacao" tab af41 electricity,m label var electricity "Household has electricity" ******************************************************************************** *** Step 2.6 Sanitation *** ******************************************************************************** /*Members of the household are considered deprived if the household's sanitation facility is not improved, according to MDG guidelines, or it is improved but shared with other household. We also checked the country reports on how the sanitation categories have been grouped. In cases of mismatch, we have followed the country report */ *Toilet tab af37, m clonevar toilet=af37 tab toilet, m *Household sharing toilet tab af38, m clonevar toiletshare=af38 tab toiletshare, m gen toilet_mdg=1 /*Not deprived in sanitation if the HH has toilet with flush inside house, flush toilet outside house, toilet without flushing, improved toilet, or improved traditional toilet */ replace toilet_mdg=0 if af37==6| af37==7 // Deprived in sanitation if the toilet is non-improved, or household is without latrine. replace toilet_mdg=. if af37==. replace toilet_mdg=0 if toiletshare==1 /*Household is assigned a value of '0' if it uses improved sanitation but shares toilet with other households */ lab var toilet_mdg "Household has improved sanitation with MDG Standards" tab toilet toilet_mdg, miss /* tab toilet, miss AF37. Where do the members of | your household go to the | greatest needs-latrine | Freq. Percent Cum. -------------------------------+----------------------------------- Toilet with flush inside house | 2,769 4.29 4.29 1 y Flush toilet outside house | 1,769 2.74 7.03 2 y toilet without flushing | 6,659 10.32 17.35 3 y Improved toilet | 7,532 11.67 29.03 4 y Improved traditional toilet | 9,114 14.13 43.15 5 y Non-improved toilet | 23,055 35.73 78.89 6 n Without retrere/latrin | 13,606 21.09 99.98 7 n . | 15 0.02 100.00 -------------------------------+----------------------------------- Total | 64,519 100.00 */ ******************************************************************************** *** Step 2.7 Drinking Water *** ******************************************************************************** /*Members of the household are considered deprived if the household does not have access to safe drinking water according to MDG guidelines, or safe drinking water is more than a 30-minute walk from home roundtrip. */ *Water source variable tab af33, m clonevar ws1=af33 tab ws1, m tab af33_especifique clonevar other_watersource=af33_especifique tab other_watersource, m *Time for drinking water source (round trip) tab af34_minutos, m clonevar watertime=af34_minutos tab watertime, m /*AF33. Main source of water supply used | for drinking by HH members | Freq. Percent Cum. ----------------------------------------+----------------------------------- | 17 0.03 0.03 0 Missing Indoor piped water | 2,949 4.57 4.60 1 y Piped water outside the house/Yard | 15,867 24.59 29.19 2 y Piped water in the neighbour's house | 5,645 8.75 37.94 3 y Public fountain/faucet water | 5,587 8.66 46.60 4 y hole/well water with manual pump | 8,674 13.44 60.04 5 y well water protected without hand pump | 4,393 6.81 66.85 6 y unprotected well water | 12,960 20.09 86.94 7 n Spring water | 654 1.01 87.95 8 n Surface water (river, lake, pond) | 6,812 10.56 98.51 9 n Rain water | 206 0.32 98.83 10 y Cistern water (or mobile tank or truck) | 336 0.52 99.35 11 n Mineral/bottled water | 386 0.60 99.95 12 y Other | 8 0.01 99.96 96 n | 6 0.01 99.97 Missing | 4 0.01 99.98 Missing . | 15 0.02 100.00 Missing ----------------------------------------+----------------------------------- Total | 64,519 100.00*/ *generating water variable as per the mdg standard gen water_mdg=. replace water_mdg=1 if ws1==1| ws1==2| ws1==3| ws1==4| ws1==5| ws1==6| ws1==10| ws1==11| ws1==12 replace water_mdg=0 if ws1==7|ws1==8|ws1==9|ws1==96 replace water_mdg=. if ws1==0| (ws1>99 & ws1<=.) /*The report categorises water source as safe and unsafe, but does not expicitely mention how they were classified. We follow the mdg criteria for classification.*/ replace water_mdg=0 if watertime>=30 & watertime<. //Recode as "0" if roundtrip to collect water is 30 minutes or more lab var water_mdg "Household has drinking water with MDG standards (considering distance)" tab ws1 water_mdg, miss ******************************************************************************** *** Step 2.8 Housing *** ******************************************************************************** /* Members of the household are considered deprived if the household has a dirt, sand or dung floor */ *Floor material tab af50, m clonevar floor=af50 tab floor, m tab af50_especifique, m clonevar other_floor=af50_especifique tab other_floor, m gen floor_imp=1 /*Non-deprived in floor if household has floor made of wood/parquet, marble/granite, cement or mosaic/brick tile.*/ replace floor_imp = 0 if floor>=5 & floor<=6 /*Deprived if floor material is made of natual or rudimentary materials such as Adobe (claimed earth), with noting, or other.*/ replace floor_imp = . if floor==. lab var floor_imp "Household has floor that it is not earth/sand/dung" ta af50 floor_imp *Wall material tab af49, m clonevar wall=af49 /* Members of the household are considered deprived if the household has wall made of natural or rudimentary materials */ codebook wall, tab(99) gen wall_imp = 0 /*Members of the household are considered deprived if wall material is Adobe/adobe block, Paus maticodos (wattle and daub), wood/zinc, bamboo/canion/palm trees/sticks, can/card/paper/bag.*/ replace wall_imp = 1 if wall==1| wall==2| wall==3 //Non-depried if wall material is cement block or brick block. replace wall_imp = . if wall==. lab var wall_imp "Household has wall that it is not of low quality materials" ta af49 wall_imp //Need to confirm if adobe/adobe block and wood/zinc are correctly categorised as wall_imp==0 ??? *Roof material /* Members of the household are considered deprived if the household has roof made of natural or rudimentary materials */ tab af48, m clonevar roof=af48 tab roof, m tab af48_especifique, m clonevar other_roof=af48_especifique tab other_roof, m gen roof_imp = 1 /*Members of the household are considered non-deprived if the roof is made of concrete slab, tile, Sheet of asbestos/lusalite, zinc plates.*/ replace roof_imp = 0 if roof==5 | roof==6 /*Members of the household are considered deprived if the roof is made of Grass/Stalk/Palm tree or other materials.*/ replace roof_imp = . if roof==. lab var roof_imp "Household has roof that it is not of low quality materials" tab af48 roof_imp, miss /*Household is deprived in housing if the roof, floor or walls uses low quality materials.*/ gen housing_1 = 1 replace housing_1 = 0 if floor_imp==0 | wall_imp==0 | roof_imp==0 replace housing_1 = . if floor_imp==. & wall_imp==. & roof_imp==. lab var housing_1 "Household has roof, floor & walls that it is not low quality material" tab housing_1, miss ******************************************************************************** *** Step 2.9 Cooking Fuel *** ******************************************************************************** /* Members of the household are considered deprived if the household cooks with solid fuels, wood, charcoal, crop residues or dung. "Indicators for Monitoring the Millennium Development Goals", p. 63 */ *Cooking fuel tab af40, m clonevar cookfuel=af40 tab cookfuel, m tab af40_especifique, m clonevar other_cookfuel=af40_especifique tab other_cookfuel,m gen cooking_mdg = 1 /*Non-deprived in cookingfuel if the main source of energy is electricity, gas, or Petroleum/Parafin/Kerosene.*/ replace cooking_mdg = 0 if cookfuel>=4 & cookfuel<=96 /*Deprived in cookingfuel if the main source of energy is charcoal, mineral coal, firewood, or Other materials.*/ replace cooking_mdg=. if cookfuel==. replace cooking_mdg=1 if other_cookfuel=="nao cozinha"|other_cookfuel=="Lanterna"|other_cookfuel=="lanterna"|other_cookfuel=="laterna" //Non-deprived if no cooking or using "Lanteran" for cooking at the household. tab cookfuel cooking_mdg, m ******************************************************************************** *** Step 2.10 Assets ownership *** ******************************************************************************** /* Members of the household are considered deprived if the household does not own more than one of: radio, TV, telephone, bike, motorbike or refrigerator and does not own a car or truck. */ tab1 television radio telephone mobiletelephone refrigerator glacier newcar oldcar tractor /// bicycle motorbike computer laptop animal_cart, m //Group telephone and mobiletelephone as a single variable replace telephone=1 if mobiletelephone==1 tab telephone mobiletelephone, m //Group the refrigerator and glacier as a single variable replace refrigerator=1 if glacier==1 tab refrigerator glacier, m //Group the newcar oldcar and tractor as a single variable clonevar car=newcar replace car=1 if oldcar==1 replace car=1 if tractor==1 tab car newcar, m tab car oldcar, m tab car tractor, m //Group computer and laptop as a single variable replace computer=1 if laptop==1 tab computer laptop, m /* Members of the household are considered deprived in assets if the household does not own more than one of: radio, TV, telephone, bike, motorbike, refrigerator, computer or animal_cart and does not own a car or truck.*/ egen n_small_assets2 = rowtotal(television radio telephone refrigerator bicycle motorbike computer animal_cart), missing lab var n_small_assets2 "Household Number of Small Assets Owned" //Assuming households missing in the ‘3_Bens Duraveis_FINAL’ dataset as the households withou any asset. replace n_small_assets2=0 if HH_asset==. gen hh_assets2 = (car==1 | n_small_assets2 > 1) replace hh_assets2 = . if car==. & n_small_assets2==. lab var hh_assets2 "Household Asset Ownership: HH has car or more than 1 small assets incl computer & animal cart" tab hh_assets2, m ******************************************************************************** *** Step 2.11 Rename and keep variables for MPI calculation ******************************************************************************** clonevar strata=provincia //Generate presence of subsample gen subsample = . *** Rename key global MPI indicators for estimation *** recode hh_mortality_5y (0=1)(1=0) , gen(d_cm) recode hh_nutrition_uw_st (0=1)(1=0) , gen(d_nutr) recode hh_child_atten (0=1)(1=0) , gen(d_satt) recode hh_years_edu6 (0=1)(1=0) , gen(d_educ) recode electricity (0=1)(1=0) , gen(d_elct) recode water_mdg (0=1)(1=0) , gen(d_wtr) recode toilet_mdg (0=1)(1=0) , gen(d_sani) recode housing_1 (0=1)(1=0) , gen(d_hsg) recode cooking_mdg (0=1)(1=0) , gen(d_ckfl) recode hh_assets2 (0=1)(1=0) , gen(d_asst) *** Keep selected variables for global MPI estimation *** keep iof_id hh_id r_mp__id survey year subsample strata weight area sex age agec7 agec4 marital hhsize region d_cm d_nutr d_satt d_educ d_elct d_wtr d_sani d_hsg d_ckfl d_asst hh_mortality_5y hh_nutrition_uw_st hh_child_atten hh_years_edu6 electricity water_mdg toilet_mdg housing_1 cooking_mdg hh_assets2 country countrycode order iof_id hh_id r_mp__id survey year subsample strata weight area sex age agec7 agec4 marital hhsize region d_cm d_nutr d_satt d_educ d_elct d_wtr d_sani d_hsg d_ckfl d_asst hh_mortality_5y hh_nutrition_uw_st hh_child_atten hh_years_edu6 electricity water_mdg toilet_mdg housing_1 cooking_mdg hh_assets2 country countrycode *** Sort, compress and save data for estimation *** sort iof_id hh_id r_mp__id compress save "$path_out/Mozambique_2019-20_pov.dta", replace log close ******************************************************************************** *** MPI Calculation (TTD file) ******************************************************************************** **SELECT COUNTRY POV FILE RUN ON LOOP FOR MORE COUNTRIES use "$path_out\Mozambique_2019-20_pov.dta", clear ******************************************************************************** *** Define Sample Weight and total population *** ******************************************************************************** gen sample_weight = weight /* change to weight if MICS*/ ******************************************************************************** *** List of the 10 indicators included in the MPI *** ******************************************************************************** gen edu_1 = hh_years_edu6 gen atten_1 = hh_child_atten gen nutri_1 = hh_nutrition_uw_st gen elec_1 = electricity gen toilet_1 = toilet_mdg gen water_1 = water_mdg gen house_1 = housing_1 gen fuel_1 = cooking_mdg gen asset_1 = hh_assets2 global est_1 edu_1 atten_1 nutri_1 elec_1 toilet_1 water_1 house_1 fuel_1 asset_1 ******************************************************************************** *** List of sample without missing values *** ******************************************************************************** foreach j of numlist 1 { gen sample_`j' = (edu_`j'!=. & atten_`j'!=. & nutri_`j'!=. & elec_`j'!=. & toilet_`j'!=. & water_`j'!=. & house_`j'!=. & fuel_`j'!=. & asset_`j'!=.) replace sample_`j' = . if subsample==0 /* Note: If the anthropometric data was collected from a subsample of the total population that was sampled, then the final analysis only includes the subsample population. */ *** Percentage sample after dropping missing values *** sum sample_`j' [iw = sample_weight] gen per_sample_weighted_`j' = r(mean) sum sample_`j' gen per_sample_`j' = r(mean) } *** ******************************************************************************** *** Define deprivation matrix 'g0' *** which takes values 1 if individual is deprived in the particular *** indicator according to deprivation cutoff z as defined during step 2 *** ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { gen g0`j'_`var' = 1 if `var'==0 replace g0`j'_`var' = 0 if `var'==1 } } *** Raw Headcount Ratios foreach j of numlist 1 { foreach var in ${est_`j'} { sum g0`j'_`var' if sample_`j'==1 [iw = sample_weight] gen raw`j'_`var' = r(mean)*100 lab var raw`j'_`var' "Raw Headcount: Percentage of people who are deprived in `var'" } } ******************************************************************************** *** Define vector 'w' of dimensional and indicator weight *** ******************************************************************************** /*If survey lacks one or more indicators, weights need to be adjusted within / each dimension such that each dimension weighs 1/3 and the indicator weights add up to one (100%). CHECK COUNTRY FILE*/ foreach j of numlist 1 { // DIMENSION EDUCATION foreach var in edu_`j' atten_`j' { capture drop w`j'_`var' gen w`j'_`var' = 1/6 } // DIMENSION HEALTH foreach var in nutri_`j' { capture drop w`j'_`var' gen w`j'_`var' = 1/3 } // DIMENSION LIVING STANDARD foreach var in elec_`j' toilet_`j' water_`j' house_`j' fuel_`j' asset_`j' { capture drop w`j'_`var' gen w`j'_`var' = 1/18 } } ******************************************************************************** *** Generate the weighted deprivation matrix 'w' * 'g0' ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { gen w`j'_g0_`var' = w`j'_`var' * g0`j'_`var' replace w`j'_g0_`var' = . if sample_`j'!=1 /*The estimation is based only on observations that have non-missing values for all variables in varlist_pov*/ } } ******************************************************************************** *** Generate the vector of individual weighted deprivation count 'c' ******************************************************************************** foreach j of numlist 1 { egen c_vector_`j' = rowtotal(w`j'_g0_*) replace c_vector_`j' = . if sample_`j'!=1 *drop w_g0_* } ******************************************************************************** *** Identification step according to poverty cutoff k (20 33.33 50) *** ******************************************************************************** foreach j of numlist 1 { foreach k of numlist 20 33 50 { gen multidimensionally_poor_`j'_`k' = (c_vector_`j'>=`k'/100) replace multidimensionally_poor_`j'_`k' = . if sample_`j'!=1 //Takes value 1 if individual is multidimensional poor } } ******************************************************************************** *** Generate the censored vector of individual weighted deprivation count 'c(k)' ******************************************************************************** foreach j of numlist 1 { foreach k of numlist 20 33 50 { gen c_censured_vector_`j'_`k' = c_vector_`j' replace c_censured_vector_`j'_`k' = 0 if multidimensionally_poor_`j'_`k'==0 } //Provide a score of zero if a person is not poor } * ******************************************************************************** *** Define censored deprivation matrix 'g0(k)' *** ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { gen g0`j'_k_`var' = g0`j'_`var' replace g0`j'_k_`var' = 0 if multidimensionally_poor_`j'_33==0 replace g0`j'_k_`var' = . if sample_`j'!=1 } } ******************************************************************************** *** Generates Multidimensional Poverty Index (MPI), *** Headcount (H) and Intensity of Poverty (A) *** ******************************************************************************** *** Multidimensional Poverty Index (MPI) *** foreach j of numlist 1 { foreach k of numlist 20 33 50 { sum c_censured_vector_`j'_`k' [iw = sample_weight] if sample_`j'==1 gen MPI_`j'_`k' = r(mean) lab var MPI_`j'_`k' "MPI with k=`k'" } sum c_censured_vector_`j'_33 [iw = sample_weight] if sample_`j'==1 gen MPI_`j' = r(mean) lab var MPI_`j' "`j' Multidimensional Poverty Index (MPI = H*A): Range 0 to 1" *** Headcount (H) *** sum multidimensionally_poor_`j'_33 [iw = sample_weight] if sample_`j'==1 gen H_`j' = r(mean)*100 lab var H_`j' "`j' Headcount ratio: % Population in multidimensional poverty (H)" *** Intensity of Poverty (A) *** sum c_censured_vector_`j'_33 [iw = sample_weight] if multidimensionally_poor_`j'_33==1 & sample_`j'==1 gen A_`j' = r(mean)*100 lab var A_`j' "`j' Intensity of deprivation among the poor (A): Average % of weighted deprivations" *** Population vulnerable to poverty (who experience 20-32.9% intensity of deprivations) *** gen temp = 0 replace temp = 1 if c_vector_`j'>=0.2 & c_vector_`j'<0.3332 replace temp = . if sample_`j'!=1 sum temp [iw = sample_weight] gen vulnerable_`j' = r(mean)*100 lab var vulnerable_`j' "`j' % Population vulnerable to poverty (who experience 20-32.9% intensity of deprivations)" drop temp *** Population in severe poverty (with intensity 50% or higher) *** gen temp = 0 replace temp = 1 if c_vector_`j'>0.49 replace temp = . if sample_`j'!=1 sum temp [iw = sample_weight] gen severe_`j' = r(mean)*100 lab var severe_`j' "`j' % Population in severe poverty (with intensity 50% or higher)" drop temp } * *** Censored Headcount *** foreach j of numlist 1 { foreach var in ${est_`j'} { sum g0`j'_k_`var' [iw = sample_weight] if sample_`j'==1 gen cen`j'_`var' = r(mean)*100 lab var cen`j'_`var' "Censored Headcount: Percentage of people who are poor and deprived in `var'" } } *** Dimensional Contribution *** foreach j of numlist 1 { foreach var in ${est_`j'} { gen cont`j'_`var' = (w`j'_`var' * cen`j'_`var')/MPI_`j' if sample_`j'==1 lab var cont`j'_`var' "% Contribution in MPI of indicator..." } } ** The line below produces the variance (inequality among the poor) ** sum c_vector_1 if c_vector_1>=1/3 & c_vector_1<=1 [aw = sample_weight], detail gen var=r(Var) *** Prepare results to export *** keep country year survey per_sample_weighted* per_sample* MPI* H* A* vulnerable* severe* raw* cen* cont* var *gen temp = (_n) *keep if temp==1 *drop temp order MPI_1 H_1 A_1 var severe_1 vulnerable_1 cont1_nutr cont1_edu_1 cont1_atten_1 cont1_fuel_1 cont1_toilet_1 cont1_water_1 cont1_elec_1 cont1_house_1 cont1_asset_1 per_sample_1 per_sample_weighted_1 raw1_nutri_1 raw1_edu_1 raw1_atten_1 raw1_fuel_1 raw1_toilet_1 raw1_water_1 raw1_elec_1 raw1_house_1 raw1_asset_1 cen1_nutri_1 cen1_edu_1 cen1_atten_1 cen1_fuel_1 cen1_toilet_1 cen1_water_1 cen1_elec_1 cen1_house_1 cen1_asset_1 codebook, compact clear