Datasets:
Upload folder using huggingface_hub
Browse files- README.md +17 -0
- generate_dataset.py +163 -0
- labor_productivity_high_burden_seed42.csv +0 -0
- labor_productivity_high_burden_seed43.csv +0 -0
- labor_productivity_high_burden_seed44.csv +0 -0
- labor_productivity_low_burden_seed42.csv +0 -0
- labor_productivity_low_burden_seed43.csv +0 -0
- labor_productivity_low_burden_seed44.csv +0 -0
- labor_productivity_moderate_seed42.csv +0 -0
- labor_productivity_moderate_seed43.csv +0 -0
- labor_productivity_moderate_seed44.csv +0 -0
README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular-classification
|
| 5 |
+
- tabular-regression
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
tags:
|
| 9 |
+
- employment
|
| 10 |
+
- labor
|
| 11 |
+
- africa
|
| 12 |
+
- synthetic-data
|
| 13 |
+
- sub-saharan-africa
|
| 14 |
+
- productivity
|
| 15 |
+
size_categories:
|
| 16 |
+
- 10K<n<100K
|
| 17 |
+
---
|
generate_dataset.py
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Labor Productivity Dataset Generator for Sub-Saharan Africa
|
| 3 |
+
|
| 4 |
+
Parameter Evidence Table:
|
| 5 |
+
| Parameter | Source | Year | Value |
|
| 6 |
+
|-----------|--------|------|-------|
|
| 7 |
+
| Labor productivity growth | ILO | 2023 | 2.1% |
|
| 8 |
+
| GDP per worker SSA | World Bank | 2023 | $8,200 |
|
| 9 |
+
| Agriculture productivity | FAO | 2023 | $3,800 |
|
| 10 |
+
| Manufacturing productivity | UNIDO | 2023 | $12,500 |
|
| 11 |
+
| Services productivity | World Bank | 2023 | $15,400 |
|
| 12 |
+
| Total factor productivity | UN | 2023 | 0.8% |
|
| 13 |
+
|
| 14 |
+
Countries: Nigeria, Kenya, Ethiopia, Ghana, South Africa, Tanzania, Uganda,
|
| 15 |
+
Rwanda, Mozambique, Zambia, Malawi, Senegal, Ivory Coast, Cameroon, Burkina Faso
|
| 16 |
+
Years: 2018-2025
|
| 17 |
+
Scenarios: low_burden (n=4000), moderate (n=5000), high (n=6000)
|
| 18 |
+
Seeds: 42, 43, 44
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
import numpy as np
|
| 22 |
+
import pandas as pd
|
| 23 |
+
from typing import Literal
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
COUNTRIES = [
|
| 27 |
+
"Nigeria", "Kenya", "Ethiopia", "Ghana", "South Africa", "Tanzania",
|
| 28 |
+
"Uganda", "Rwanda", "Mozambique", "Zambia", "Malawi", "Senegal",
|
| 29 |
+
"Ivory Coast", "Cameroon", "Burkina Faso"
|
| 30 |
+
]
|
| 31 |
+
|
| 32 |
+
COUNTRY_CODES = {
|
| 33 |
+
"Nigeria": "NGA", "Kenya": "KEN", "Ethiopia": "ETH", "Ghana": "GHA",
|
| 34 |
+
"South Africa": "ZAF", "Tanzania": "TZA", "Uganda": "UGA", "Rwanda": "RWA",
|
| 35 |
+
"Mozambique": "MOZ", "Zambia": "ZMB", "Malawi": "MWI", "Senegal": "SEN",
|
| 36 |
+
"Ivory Coast": "CIV", "Cameroon": "CMR", "Burkina Faso": "BFA"
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
YEARS = list(range(2018, 2026))
|
| 40 |
+
SECTORS = ["agriculture", "mining", "manufacturing", "construction",
|
| 41 |
+
"wholesale_retail", "transport", "services"]
|
| 42 |
+
FIRM_SIZES = ["micro", "small", "medium", "large"]
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def dag_sample_productivity(node: str, parent_values: dict, rng: np.random.Generator,
|
| 46 |
+
year: int, country: str) -> any:
|
| 47 |
+
if node == "sector":
|
| 48 |
+
return rng.choice(SECTORS, p=[0.28, 0.04, 0.10, 0.06, 0.22, 0.08, 0.22])
|
| 49 |
+
|
| 50 |
+
elif node == "firm_size":
|
| 51 |
+
return rng.choice(FIRM_SIZES, p=[0.65, 0.20, 0.10, 0.05])
|
| 52 |
+
|
| 53 |
+
elif node == "technology_level":
|
| 54 |
+
sector = parent_values.get("sector", "services")
|
| 55 |
+
|
| 56 |
+
if sector in ["manufacturing", "mining"]:
|
| 57 |
+
return rng.choice(["low", "medium", "high"], p=[0.35, 0.45, 0.20])
|
| 58 |
+
elif sector in ["transport", "services"]:
|
| 59 |
+
return rng.choice(["low", "medium", "high"], p=[0.40, 0.40, 0.20])
|
| 60 |
+
else:
|
| 61 |
+
return rng.choice(["low", "medium", "high"], p=[0.65, 0.28, 0.07])
|
| 62 |
+
|
| 63 |
+
elif node == "export_orientation":
|
| 64 |
+
sector = parent_values.get("sector", "services")
|
| 65 |
+
|
| 66 |
+
if sector == "manufacturing":
|
| 67 |
+
return rng.choice(["none", "domestic", "export"], p=[0.45, 0.35, 0.20])
|
| 68 |
+
elif sector == "agriculture":
|
| 69 |
+
return rng.choice(["none", "domestic", "export"], p=[0.55, 0.35, 0.10])
|
| 70 |
+
else:
|
| 71 |
+
return rng.choice(["none", "domestic", "export"], p=[0.75, 0.20, 0.05])
|
| 72 |
+
|
| 73 |
+
return None
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def calculate_productivity(parent_values: dict, rng: np.random.Generator,
|
| 77 |
+
year: int, country: str) -> float:
|
| 78 |
+
sector = parent_values.get("sector", "services")
|
| 79 |
+
firm_size = parent_values.get("firm_size", "small")
|
| 80 |
+
tech_level = parent_values.get("technology_level", "low")
|
| 81 |
+
export = parent_values.get("export_orientation", "none")
|
| 82 |
+
|
| 83 |
+
sector_productivity = {
|
| 84 |
+
"agriculture": 3800, "mining": 25000, "manufacturing": 12500,
|
| 85 |
+
"construction": 8500, "wholesale_retail": 6500, "transport": 11000,
|
| 86 |
+
"services": 15400
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
firm_multipliers = {"micro": 0.45, "small": 0.75, "medium": 1.0, "large": 1.35}
|
| 90 |
+
tech_multipliers = {"low": 0.75, "medium": 1.0, "high": 1.45}
|
| 91 |
+
export_multipliers = {"none": 0.85, "domestic": 1.0, "export": 1.25}
|
| 92 |
+
|
| 93 |
+
base = sector_productivity.get(sector, 10000)
|
| 94 |
+
base *= firm_multipliers.get(firm_size, 1.0)
|
| 95 |
+
base *= tech_multipliers.get(tech_level, 1.0)
|
| 96 |
+
base *= export_multipliers.get(export, 1.0)
|
| 97 |
+
|
| 98 |
+
return base * rng.lognormal(0, 0.3)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def generate_labor_productivity_data(
|
| 102 |
+
scenario: Literal["low_burden", "moderate", "high_burden"],
|
| 103 |
+
seed: int,
|
| 104 |
+
country: str = None
|
| 105 |
+
) -> pd.DataFrame:
|
| 106 |
+
"""Generate labor productivity dataset for SSA."""
|
| 107 |
+
n_samples = {"low_burden": 4000, "moderate": 5000, "high_burden": 6000}[scenario]
|
| 108 |
+
|
| 109 |
+
rng = np.random.default_rng(seed)
|
| 110 |
+
|
| 111 |
+
if country:
|
| 112 |
+
countries = [country]
|
| 113 |
+
else:
|
| 114 |
+
countries = COUNTRIES
|
| 115 |
+
|
| 116 |
+
records = []
|
| 117 |
+
samples_per_country = n_samples // len(countries)
|
| 118 |
+
|
| 119 |
+
for cntry in countries:
|
| 120 |
+
for _ in range(samples_per_country):
|
| 121 |
+
year = rng.choice(YEARS)
|
| 122 |
+
|
| 123 |
+
sector = dag_sample_productivity("sector", {}, rng, year, cntry)
|
| 124 |
+
firm_size = dag_sample_productivity("firm_size", {}, rng, year, cntry)
|
| 125 |
+
|
| 126 |
+
parent_values = {"sector": sector, "firm_size": firm_size}
|
| 127 |
+
tech_level = dag_sample_productivity("technology_level", parent_values, rng, year, cntry)
|
| 128 |
+
export = dag_sample_productivity("export_orientation", parent_values, rng, year, cntry)
|
| 129 |
+
|
| 130 |
+
parent_values["technology_level"] = tech_level
|
| 131 |
+
parent_values["export_orientation"] = export
|
| 132 |
+
|
| 133 |
+
productivity = calculate_productivity(parent_values, rng, year, cntry)
|
| 134 |
+
|
| 135 |
+
records.append({
|
| 136 |
+
"country": cntry,
|
| 137 |
+
"country_code": COUNTRY_CODES[cntry],
|
| 138 |
+
"year": year,
|
| 139 |
+
"sector": sector,
|
| 140 |
+
"firm_size": firm_size,
|
| 141 |
+
"technology_level": tech_level,
|
| 142 |
+
"export_orientation": export,
|
| 143 |
+
"labor_productivity_usd": round(productivity, 2),
|
| 144 |
+
"value_added_per_worker": round(productivity * 0.65, 2),
|
| 145 |
+
"output_per_hour": round(productivity / 2000, 2),
|
| 146 |
+
"scenario": scenario
|
| 147 |
+
})
|
| 148 |
+
|
| 149 |
+
df = pd.DataFrame(records)
|
| 150 |
+
df.attrs["seed"] = seed
|
| 151 |
+
df.attrs["scenario"] = scenario
|
| 152 |
+
df.attrs["source"] = "ILO, World Bank, FAO, UNIDO"
|
| 153 |
+
|
| 154 |
+
return df
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
if __name__ == "__main__":
|
| 158 |
+
for scenario in ["low_burden", "moderate", "high_burden"]:
|
| 159 |
+
for seed in [42, 43, 44]:
|
| 160 |
+
df = generate_labor_productivity_data(scenario, seed)
|
| 161 |
+
filename = f"labor_productivity_{scenario}_seed{seed}.csv"
|
| 162 |
+
df.to_csv(filename, index=False)
|
| 163 |
+
print(f"Created {filename}: {len(df)} records")
|
labor_productivity_high_burden_seed42.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
labor_productivity_high_burden_seed43.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
labor_productivity_high_burden_seed44.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
labor_productivity_low_burden_seed42.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
labor_productivity_low_burden_seed43.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
labor_productivity_low_burden_seed44.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
labor_productivity_moderate_seed42.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
labor_productivity_moderate_seed43.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
labor_productivity_moderate_seed44.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|