ESTHER-ineq Documentation (v0.1.0)¶
Welcome to the documentation of ESTHER-ineq (Epidemiological Statistics Toolkit for Health Inequality Estimation and Reporting in Python).
Contents¶
- Ecosystem Benchmark (R, Python, and Stata): Technical comparison against CRAN, PyPI, and Stata SSC/DASP/WHO packages for complex survey and disaggregated surveillance data.
- Mathematical and Statistical Methodology: Exact formulas for tie-integrated fractional ranks, Gâteaux Influence Functions (
IF/RIF), Ultimate-Cluster complex survey variance,SII/RII,DSR/SMR/HIstandardization, Wagstaff andRIF-Oaxacadecompositions, and all 21 WHO summary measures. - API Reference: Reference for
SurveyHealthData,GroupedHealthData, estimation functions, plotting functions, and multilingualSTROBE-Equityreporting.
Core Workflows¶
A. Complex Survey Microdata (DHS, MICS, STEPS, NHANES, ENDES, ENAHO)¶
import esther_ineq as ei
df = ei.datasets.load_survey_mch()
df["quintile"] = ei.xtile(df["wealth_score"], weights=df["sample_weight"], n_quantiles=5)
svy = ei.SurveyHealthData(
df,
weights="sample_weight",
strata="stratum_id",
psu="cluster_id",
)
# 1. Sensitivity table across standard, Wagstaff, and Erreygers concentration indices
ci_multi = svy.concentration_index(
outcome="stunting",
rank="wealth_score",
method=["standard", "wagstaff", "erreygers"],
favorable=False,
)
# 2. All 21 WHO summary measures on survey microdata
who_21 = svy.who_summary(
outcome="full_immunization",
dimension="quintile",
ordered=True,
favorable=True,
scale=100.0,
)
# 3. Indirect need standardization and horizontal inequity index
hi = svy.horizontal_inequity(
outcome="outpatient_visits",
rank="wealth_score",
need_vars=["child_age_mo", "female", "chronic_morbidity"],
non_need_vars=["wealth_score", "mother_edu", "area"],
categorical=["mother_edu", "area"],
family="poisson",
)
# 4. Counterfactual RIF-Oaxaca decomposition across survey waves
rif_oax = svy.decompose_oaxaca_rif(
formula="stunting ~ C(mother_edu) + C(area) + improved_sanitation + child_age_mo",
rank="wealth_score",
group="survey_wave",
group_levels=(2018, 2025),
method="erreygers",
)
B. Routine Surveillance and Disaggregated Subgroup Tables¶
import esther_ineq as ei
# 1. Disaggregated wealth quintile summary table
df_agg = ei.datasets.load_who_disaggregated(dimension="wealth")
grp = ei.GroupedHealthData(
df_agg,
subgroup="subgroup",
estimate="estimate",
se="se",
population="population",
ordered=True,
favorable=True,
scale=100.0,
)
print(grp.who_summary(measures="all").to_markdown())
# 2. Directly standardized mortality rates (exact Dobson CIs) and funnel plot
df_dist = ei.datasets.load_district_mortality()
dsr = ei.direct_standardize(
df_dist,
events="deaths",
population="population",
stratum="age_group",
group="district",
standard_pop="who_broad_5",
)
fig, ax = ei.funnel_plot(dsr)