This release is a pre-release and may not be stable for production use.
PyFCIRT
Bayesian forced-choice modeling in Python and R.
Overview
PyFCIRT is a high-level Bayesian forced-choice modeling interface with Python and R APIs. 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, install PyFCIRT with CUDA Runtime 13.0.96.
python -m pip install --pre "pyfcirt[cuda13]" "nvidia-cuda-runtime==13.0.96"
conda
conda install -c qipengchen/label/beta -c conda-forge pyfcirt
Docker
CPU:
docker run --rm -it ghcr.io/qipengchen/pyfcirt:0.1.0b2-cpu
NVIDIA GPU (CUDA 13):
docker run --rm -it --gpus all ghcr.io/qipengchen/pyfcirt:0.1.0b2-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.
Quick start in R
Install the R development package from the source checkout. In R, install
ggplot2, posterior, and reticulate if needed. Then run these commands
from the repository root in the Python environment that R will use. Set
RETICULATE_PYTHON to that environment's Python executable before starting R.
python -m pip install ".[io,covariates,numpyro]"
R CMD INSTALL r/pyfcirt
Fit TIRT to the same 100 respondents and 24 triplets as in the Python example.
library(pyfcirt)
example <- load_example("tirt_study", model = "TIRT")
head(example$design, 3)
head(example$responses, 3)
m <- model()
m$add_fc(example$design, example$responses, format = example$format,
model = "TIRT", response_format = example$response_format)
m$prepare()
m$fit(random_seed = 42L)
coef(m, blocks = "B1", kind = "stats", digits = 2L)
See the R examples and R API reference.
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.0b2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyfcirt-0.1.0b2.tar.gz | 2.0 MB | With provenance | Details for pyfcirt-0.1.0b2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyfcirt-0.1.0b2-py3-none-any.whl | Python 3 | none | any | Details for pyfcirt-0.1.0b2-py3-none-any.whl |
Total release size: 4.1 MB
Release files / pyfcirt-0.1.0b2.tar.gz
| Download URL | pyfcirt-0.1.0b2.tar.gz |
|---|---|
| Size | 2.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a488f9f4d20495d3162b243cc0b9bcb869b9adfb3b0a4bf1c4a718109dd4fef0
|
|
BLAKE2b-256 checksum How to use checksums |
8202a45ca16b4df51226735737c71ccd0e9819f14906107cf9d51f29fde5fbc6
|
| 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 23, 2026.
Transparency logRelease files / pyfcirt-0.1.0b2-py3-none-any.whl
| Download URL | pyfcirt-0.1.0b2-py3-none-any.whl |
|---|---|
| Size | 2.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e84ee448ac67b79537e149aee4dae34c7f9e00828e7604fb0c1379fc9e22cd5
|
|
BLAKE2b-256 checksum How to use checksums |
59456c255645bf069cfb00d4dafd25af3e4e645fb12df15c7ea7f0c0190e9817
|
| 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 23, 2026.
Transparency logSecurity for pyfcirt 0.1.0b2
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.
Attestation for pyfcirt-0.1.0b2.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 23, 2026.
Transparency logA 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.