Skip to main content

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

  1. Item severity parameters for each FIES question via weighted CML.
  2. Person parameters per raw score (post-hoc MLE conditional on item parameters).
  3. Equating to the FAO 2014–2016 global metric so prevalence rates are comparable across countries and survey rounds.
  4. Prevalence rates at any latent-trait threshold via Gaussian-mixture probabilistic assignment.

Methodology references

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

Apache 2.0.

Metadata

Release files for pyfies 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfies 0.1.1
File Size Uploaded
pyfies-0.1.1.tar.gz 60.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyfies 0.1.1
File Interpreter ABI Platform
pyfies-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 84.1 kB

Release files / pyfies-0.1.1.tar.gz

Download URL pyfies-0.1.1.tar.gz
Size 60.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b69b7fcdb4e8dde2c8f650ba006b761050b8767bccdcf6da998ffaa4b1921710
BLAKE2b-256 checksum
How to use checksums
b4c89f7abe60bb227a8153c7db67868ba0a73616a9f2eabbd165c974b0924191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Release files / pyfies-0.1.1-py3-none-any.whl

Download URL pyfies-0.1.1-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bcda80adfd5cb619afc09a494005dc265769339388b50b6dd30fd9d38f3d115
BLAKE2b-256 checksum
How to use checksums
12289ba36cb261845c0ca2e97a274a25138bc80d001157063b34eca245f79d7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page