Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PyFCIRT

Bayesian forced-choice modeling in Python.

Checks Coverage Ruff License

Overview

PyFCIRT is a high-level Bayesian forced-choice modeling interface written in Python. Built on the PyMC probabilistic programming framework, it is designed to make forced-choice models easy to specify, fit, and evaluate. GPU-accelerated sampling is available through JAX.

Supported models

Forced-choice: dominance models

  • Thurstonian item response theory model (TIRT).
  • Thurstonian IRT model with a joint-ranking likelihood (TIRTRank).
  • Two-parameter logistic model for rankings (TwoPLRank).
  • Multidimensional generalized partial preference model (MGPPM).

Forced-choice: ideal-point models

  • Generalized Thurstonian unfolding model (GTUM).
  • Generalized graded unfolding model for rankings (GGUMRank).

Likert and dichotomous models

  • One- to four-parameter logistic IRT models (DichotomousIRT).
  • Generalized partial credit model (GPCM).
  • Generalized graded unfolding model (GGUM).

Different measurement models can be combined within a test, including forced-choice, Likert, and dichotomous models.

Installation

Use Python 3.12 or later for pip or conda. These commands install the beta release.

pip

python -m pip install --pre pyfcirt

For NVIDIA GPU sampling on Linux or WSL 2:

python -m pip install --pre "pyfcirt[cuda13]"

conda

conda install -c qipengchen/label/beta -c conda-forge pyfcirt

Docker

CPU:

docker run --rm -it ghcr.io/qipengchen/pyfcirt:0.1.0b1-cpu

NVIDIA GPU (CUDA 13):

docker run --rm -it --gpus all ghcr.io/qipengchen/pyfcirt:0.1.0b1-cuda13

See GPU setup for compatibility and verification.

Your first analysis

Fit TIRT to a simulated teaching dataset with 100 respondents and 24 triplets. The design table assigns each statement to a block and trait; the response table contains one person's judgment of a named statement pair per row.

import pyfcirt as fc

example = fc.load_example("tirt_study", model="TIRT")
design_df = example.data.design
response_df = example.data.responses.frame

# design_df.head(3):
# block_id position statement_id trait keying
#       B1        1           S1    T1      1
#       B1        2           S2    T2      1
#       B1        3           S3    T3      1

# response_df.head(3):
# person_id block_id statement_1 statement_2 response
#        P1       B1          S1          S2        0
#        P1       B1          S1          S3        1
#        P1       B1          S2          S3        1

Register the design and responses, then fit TIRT.

model = fc.Model()
model.add_fc(
    design_df,
    response_df,
    format="comparison_long",
    model="TIRT",
)
model.prepare()
model.fit(random_seed=42)
model.coef(blocks=["B1"], kind="stats", round_to="auto")

model="TIRT" selects the measurement model. Each response records a pair judgment. Response 1 prefers the first statement; 0 prefers the second. In the design, position gives presentation order and keying gives the loading direction on the named trait.

model.coef() reports posterior means, standard deviations and uncertainty intervals for the statements and pairs in B1.

Follow the examples for prior prediction, diagnostics and model checks, and use the API reference for individual calls. Use Prepare your data to define your own design and read CSV or spreadsheet responses.

Documentation

Contributing

Questions, bug reports, and feature suggestions are welcome through GitHub Issues.

For bug reports, include a small reproducible example and the package versions used. Contributions can be submitted through pull requests.

License

PyFCIRT is primarily licensed under the MIT License. See NOTICE for the JAX attribution retained from earlier revisions.

Metadata

Release files for pyfcirt 0.1.0b1

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

Source distribution (sdist)

Source distribution for pyfcirt 0.1.0b1
File Size Uploaded Provenance Actions
pyfcirt-0.1.0b1.tar.gz 2.1 MB With provenance Details for pyfcirt-0.1.0b1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyfcirt 0.1.0b1
File Interpreter ABI Platform Actions
pyfcirt-0.1.0b1-py3-none-any.whl Python 3 none any Details for pyfcirt-0.1.0b1-py3-none-any.whl

Total release size: 4.2 MB

Release files / pyfcirt-0.1.0b1.tar.gz

Download URL pyfcirt-0.1.0b1.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
c6feef42d2d256cbd4eedefd5d6e19bbc852dc24acc409722eb006134df67b9f
BLAKE2b-256 checksum
How to use checksums
899c77928a99e960e77bdec2c1becbad1ea336115cf3b02a4eb94af79a9f205e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 20, 2026.

Transparency log

Release files / pyfcirt-0.1.0b1-py3-none-any.whl

Download URL pyfcirt-0.1.0b1-py3-none-any.whl
Size 2.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6476d50b1f642c284a9789bb0e6f980bafa505d44a49a7191213e627723dc328
BLAKE2b-256 checksum
How to use checksums
f8cce3116a8922fe3425de025bd6d406bac2232096e611d37911ba9db6f746f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 20, 2026.

Transparency log

Security for pyfcirt 0.1.0b1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyfcirt-0.1.0b1.tar.gz

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 Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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