Python implementation of FAO's Food Insecurity Experience Scale (FIES) — the methodology behind UN SDG indicator 2.1.2 (prevalence of moderate-or-severe and severe food insecurity in the population).
pyfies is a from-scratch port of the R package
RM.weights (Cafiero, Viviani, Nord),
implementing the weighted Conditional Maximum Likelihood (CML) Rasch estimator,
equating to FAO's 2014–2016 global standard, and probabilistic prevalence
assignment along the latent food-insecurity trait.
Status: alpha. v0.1 covers the dichotomous Rasch model, equating, and prevalence estimation. The polytomous (partial credit) extension and full diagnostics suite are planned for v0.2.
pip install pyfies # from PyPI
pip install -e ".[dev]" # editable install with dev toolingRequires Python 3.11+.
import pandas as pd
from pyfies import RaschModel, FAO_2014_2016, DEFAULT_FIES_ITEMS
# df has 8 columns named WORRIED, HEALTHY, FEWFOOD, SKIPPED,
# ATELESS, RUNOUT, HUNGRY, WHLDAY (1=affirmative, 0=negative, NA=missing)
X = df[DEFAULT_FIES_ITEMS].to_numpy()
w = df["sampling_weight"].to_numpy()
model = RaschModel().fit(X, sample_weight=w)
model.equate(reference=FAO_2014_2016)
result = model.prevalence()
print(f"Moderate or severe food insecurity: {result.moderate_or_severe:.1%}")
print(f"Severe food insecurity: {result.severe:.1%}")- Item severity parameters for each FIES question via weighted CML.
- Person parameters per raw score (post-hoc MLE conditional on item parameters).
- Equating to the FAO 2014–2016 global metric so prevalence rates are comparable across countries and survey rounds.
- Prevalence rates at any latent-trait threshold via Gaussian-mixture probabilistic assignment.
- FAO. The Food Insecurity Experience Scale — Development of a Global Standard for Monitoring Hunger Worldwide. Technical Paper v1.1, 2016. link
- Cafiero, C., Viviani, S., Nord, M. (2018). Food security measurement in a global context: The Food Insecurity Experience Scale. Measurement, 116, 146–152. doi:10.1016/j.measurement.2017.10.065
- FAO. Voices of the Hungry / FIES landing page.
pyFIES is validated against the reference R package on the data.FAO_country1..4
sample datasets shipped with RM.weights. To regenerate parity fixtures (R
required, one-time):
Rscript scripts/generate_r_fixtures.RTolerances: atol=2e-4 on item severities, atol=5e-3 on prevalence rates
(typically achieved within 0.3 percentage points). See
Parity for details.
If you use pyFIES in published research, please cite both the package and the
underlying FAO methodology. The package's "Cite this repository" button on
GitHub (powered by CITATION.cff) will give you the
package citation in BibTeX, APA, and other formats. The Zenodo Concept DOI
always resolves to the latest release. To pin to a specific version, use the version-specific DOI shown on the Zenodo record page.
For the underlying methodology, cite Cafiero, C., Viviani, S., & Nord, M. (2018). Food security measurement in a global context: The Food Insecurity Experience Scale. Measurement, 116, 146–152. doi:10.1016/j.measurement.2017.10.065.