Supplementary File 2 - Replication code

Paper:   How Well Does an Asset-Based Wealth Index Rank Households? Construction
         and Validation against Consumption in Bangladesh's Household Income and
         Expenditure Survey 2022
Author:  Atikur Rahman, White Globe Initiative, Dhaka, Bangladesh
         atik@whiteglobeinitiative.org | ORCID 0009-0000-2936-819X

DATA
The code uses the household-level microdata of the Bangladesh Household Income
and Expenditure Survey (HIES) 2022, produced by the Bangladesh Bureau of
Statistics (BBS). The data are not redistributed here; they can be requested
from BBS. Files used (Stata format, as released by BBS):
  weight_final_2022, HH_SEC_1A, HH_SEC_1A1, HH_SEC_2A, HH_SEC_2B, HH_SEC_6A,
  HH_SEC_7A, HH_SEC_7C1, HH_SEC_7E, HH_SEC_9A1, HH_SEC_9B2, HH_SEC_9C,
  HH_SEC_9D1, HH_SEC_9D2, HH_SEC_9E

SOFTWARE
Stata 16.1 or later. Only built-in commands are used; no packages to install.
A full run takes about two minutes on a standard desktop.

HOW TO RUN
1. Put the .do files in <project folder>\01_do\
2. Open 01_master.do and edit the two lines marked "the only two lines to
   change": the folder holding the BBS .dta files and the project folder.
   06_journal_figures.do uses the same project folder.
3. Run 01_master.do. All sub-folders are created, every step runs in order,
   and each step writes a text log to 04_logs.

WHAT EACH FILE PRODUCES
02_prepare_indicators.do  02_data\wi_indicators.dta: 83 indicators, one row
                          per household (14,395 rows)
03_wealth_index_pca.do    02_data\hies2022_wealth_index.dta: composite score
                          (wi_score), quintiles (wi_q5), deciles (wi_q10),
                          household-weighted and within-area quintiles.
                          Tables: wi_eigen.csv (Table 2), wi_loadings.csv
                          (Table 3, Supplementary File 1, Table S1),
                          wi_combination.csv, wi_quintile_cutoffs.csv,
                          wi_imputed.csv
04_robustness.do          Versions R1-R7 and robustness.csv (Table 7). The
                          program first rebuilds the main index and stops
                          with an error if it does not reproduce wi_score.
05_validation.do          Consumption aggregate (02_data\wi_consumption.dta),
                          Tables 4-6, val_*.csv
06_journal_figures.do     Fig1-Fig3 (EPS and TIFF) and fig3_decile_data.csv

KEY CHECKS BUILT INTO THE CODE
- pop_wgt equals hh_wgt x household size
- unique household identifiers in every file; 14,395 households at the end
- no missing indicator after item imputation among scored households
- the robustness program reproduces the main index to 1e-6
- consumption means are printed next to the published BBS figures
