""" Multidimensional Poverty Africa Dataset Generator Parameter Evidence Table: | Parameter | Source | Value | Notes | |-----------|--------|-------|-------| | MPI Threshold | UNDP/OPHI | <=0.33 | Multidimensional poverty threshold | | Severe MPI | UNDP/OPHI | >0.5 | Severe multidimensional poverty | | Health deprivation | MPI | 1/3 weight | Health dimension weight | | Education deprivation | MPI | 1/3 weight | Education dimension weight | | Living standards | MPI | 1/3 weight | Standard of living weight | Countries: 15 African nations Years: 2018-2025 """ import numpy as np import pandas as pd from pathlib import Path COUNTRIES = [ "Nigeria", "Ethiopia", "Tanzania", "Kenya", "Uganda", "Mozambique", "Ghana", "Cote d'Ivoire", "Cameroon", "Senegal", "Zambia", "Malawi", "Rwanda", "Burkina Faso", "Mali" ] YEARS = list(range(2018, 2026)) BASE_MPI = 0.28 COUNTRY_MPI = { "Nigeria": 0.35, "Ethiopia": 0.33, "Tanzania": 0.30, "Kenya": 0.18, "Uganda": 0.24, "Mozambique": 0.38, "Ghana": 0.14, "Cote d'Ivoire": 0.22, "Cameroon": 0.23, "Senegal": 0.19, "Zambia": 0.27, "Malawi": 0.31, "Rwanda": 0.20, "Burkina Faso": 0.28, "Mali": 0.32 } DIMENSION_WEIGHTS = { "health": 0.33, "education": 0.33, "living_standards": 0.34 } INDICATOR_WEIGHTS = { "nutrition": 0.17, "child_mortality": 0.16, "years_of_schooling": 0.17, "school_attendance": 0.16, "cooking_fuel": 0.085, "sanitation": 0.085, "drinking_water": 0.085, "electricity": 0.085, "housing": 0.085, "assets": 0.085 } def generate_dataset(scenario: str, seed: int) -> pd.DataFrame: """Generate multidimensional poverty dataset for Africa.""" np.random.seed(seed) rng = np.random.default_rng(seed) scenario_config = { "low_burden": {"n": 4000, "variance_scale": 0.8}, "moderate": {"n": 5000, "variance_scale": 1.0}, "high_burden": {"n": 6000, "variance_scale": 1.2} } config = scenario_config[scenario] n = config["n"] scale = config["variance_scale"] records = [] for year in YEARS: year_factor = 1.0 - (year - 2018) * 0.012 for country in COUNTRIES: mpi = COUNTRY_MPI[country] * year_factor * scale mpi = min(0.6, max(0.05, mpi)) health_score = mpi * DIMENSION_WEIGHTS["health"] + rng.normal(0, 0.03) education_score = mpi * DIMENSION_WEIGHTS["education"] + rng.normal(0, 0.03) living_score = mpi * DIMENSION_WEIGHTS["living_standards"] + rng.normal(0, 0.03) n_country_year = n // (len(YEARS) * len(COUNTRIES)) for _ in range(n_country_year): records.append({ "country": country, "year": year, "mpi": mpi + rng.normal(0, 0.015 * scale), "headcount_ratio": min(0.95, max(0.05, mpi * 2.5 + rng.normal(0, 0.02))), "intensity": min(0.6, max(0.1, mpi / max(0.01, mpi * 2.5))), "health_deprivation": max(0, min(1, health_score + rng.normal(0, 0.04))), "education_deprivation": max(0, min(1, education_score + rng.normal(0, 0.04))), "living_standards_deprivation": max(0, min(1, living_score + rng.normal(0, 0.04))), "is_poor": mpi < 0.33, "is_severely_poor": mpi > 0.5 }) df = pd.DataFrame(records) df["mpi"] = df["mpi"].clip(0, 1) return df def main(): output_dir = Path(__file__).parent output_dir.mkdir(parents=True, exist_ok=True) scenarios = {"low_burden": 42, "moderate": 43, "high_burden": 44} for scenario, seed in scenarios.items(): df = generate_dataset(scenario, seed) df.to_csv(output_dir / f"multidimensional_poverty_{scenario}.csv", index=False) print(f"Generated {scenario}: {len(df)} rows, seed={seed}") if __name__ == "__main__": main()