Python implementation of FAO's Food Insecurity Experience Scale (FIES) — weighted Rasch model, equating to the global standard, and prevalence estimation for SDG indicator 2.1.2.
Project description
pyFIES
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.
Installation
pip install pyfies # from PyPI (once published)
pip install -e ".[dev]" # editable install with dev tooling
Requires Python 3.11+.
Quickstart
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%}")
What it computes
- 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.
Methodology references
- 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.
Numerical parity with RM.weights
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.R
Default tolerance: atol=1e-6 on item severities and prevalence rates.
Citing
If you use pyFIES in published research, please cite both this package and the
underlying FAO methodology (Cafiero et al., 2018). A CITATION.cff file will be
added at first stable release.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyfies-0.1.0.tar.gz.
File metadata
- Download URL: pyfies-0.1.0.tar.gz
- Upload date:
- Size: 60.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bee941d345d6229da0bcad38398faaa47e1e37d5c9ce13fd978288290a13df5
|
|
| MD5 |
fb1813ea3afc3a15b67d355c626a515d
|
|
| BLAKE2b-256 |
3dd3e11e0206b71332d6dc19f0f7454d9b3c0a49d530f664c4c34c1cedbe1540
|
Provenance
The following attestation bundles were made for pyfies-0.1.0.tar.gz:
Publisher:
release.yml on nejohnson2/pyFIES
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyfies-0.1.0.tar.gz -
Subject digest:
3bee941d345d6229da0bcad38398faaa47e1e37d5c9ce13fd978288290a13df5 - Sigstore transparency entry: 1396031534
- Sigstore integration time:
-
Permalink:
nejohnson2/pyFIES@53ab73db9ba496ade86fd1ee2f40b58dfde86e3d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nejohnson2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@53ab73db9ba496ade86fd1ee2f40b58dfde86e3d -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyfies-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyfies-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a1d5f04bdcd9a37c182321f43c5989deb6af5706019ea9304c62ea144728430
|
|
| MD5 |
54ce347f6ff5d429e6cf17428bad8fc5
|
|
| BLAKE2b-256 |
5284f34ca6fd5fe8a00554c65626c50e5daf96542e9bd668af2b30388d746347
|
Provenance
The following attestation bundles were made for pyfies-0.1.0-py3-none-any.whl:
Publisher:
release.yml on nejohnson2/pyFIES
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyfies-0.1.0-py3-none-any.whl -
Subject digest:
1a1d5f04bdcd9a37c182321f43c5989deb6af5706019ea9304c62ea144728430 - Sigstore transparency entry: 1396031542
- Sigstore integration time:
-
Permalink:
nejohnson2/pyFIES@53ab73db9ba496ade86fd1ee2f40b58dfde86e3d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nejohnson2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@53ab73db9ba496ade86fd1ee2f40b58dfde86e3d -
Trigger Event:
push
-
Statement type: