Skip to main content

logit-stream

Logit models for data that do not fit in memory: binary, multinomial, ordered, conditional, nested and mixed logit, fitted by Newton's method with the data streamed off disk, from pyfixest-style formulas, with absorbed fixed effects, random intercepts or random slopes.

from logit_stream import mlogit_stream

fit = mlogit_stream(
    "race ~ C(agecat) + female + C(inccat) + C(cit) | puma",
    "acs/*.parquet",               # a Parquet path or glob, never fully loaded
    vcov={"CRV1": "puma"},
)
fit.summary()
fit.predict("people/*.parquet").sink_parquet("imputed.parquet")   # lazily
logit_stream, probit_stream binary logit and probit with any number of fixed effects (with at most one through this package's own engine, otherwise hdfe-stream's feglm_stream)
mlogit_stream multinomial logit (any number of fixed effects; several through a Poisson regression)
ologit_stream, oprobit_stream ordered logit and probit
clogit_stream conditional (McFadden) logit on long-format choice data
cfelogit_stream Chamberlain's conditional fixed-effects logit for panels
nlogit_stream, mixlogit_stream nested logit; mixed logit (experimental)

Newton's method for a logit needs the data only through sums over rows -- the log-likelihood, its gradient and the information matrix -- so each step is one read of the data, block by block, and one dense solve; the likelihoods are concave, so a handful of steps suffice. Memory grows with the number of coefficients, not of rows. The multinomial and ordered logit absorb one fixed effect exactly, by eliminating its per-level blocks of the information matrix in every step.

Random intercepts for the binary, multinomial and ordered logit are fitted by Laplace's approximation (nested or crossed groupings, as lme4's glmer and ordinal's clmm) or by adaptive quadrature. Random slopes (experimental) let a covariate's coefficient vary by group: with its intercept in those models (random={"school": ["1", "prior"]}, by adaptive quadrature), and by region in the conditional logit (random={"cz": "dist"}, the region the choice set's or each alternative's).

Results share hdfe-stream's reporting: summary(), tidy(), summary_dict(), summary_json(), confint(), wald_test(), with_vcov(), etable(), and lazy predict(), resid(), sample() and fixef() frames. Estimates and standard errors match statsmodels and scikit-learn (see tests/).

For imputation, predict() streams probabilities, or draws of the outcome (type="draw"), for files of any size. draw_parameters() and draw_ranef() draw the parameters and each group's effect for proper multiple imputation, and pool() and pool_matrix() combine the analyses of the completed data by Rubin's rules. For a choice among alternatives whose totals are known, predict(calibrate=) solves the alternatives' constants from the totals, and logit_stream.assign (experimental) draws assignments that match them exactly or approximately.

Documentation: https://leetucker.github.io/logit-stream/ (build locally with pip install -e ".[docs]" and sphinx-build -b html docs docs/_build/html). examples/ has the runnable scripts its guide's pages follow, on simulated data.

Install

pip install logit-stream

Python 3.10 or later.

Benchmarks

benchmarks/ compares logit-stream with scikit-learn, statsmodels, mord and R's glm, fixest, nnet, MASS and ordinal on American Community Survey microdata (10,000 to 12.9 million adults); with xlogit, pylogit, statsmodels, jaxlogit, Biogeme and R's mlogit and logitr on the Swissmetro choice survey, resampled to 10 million choice sets; on short panels with statsmodels and R's survival, fixest and alpaca; and on a GPU. See benchmarks/README.md and the documentation's benchmark pages.

License

MIT.

Metadata

Release files for logit-stream 0.5.0

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

Source distribution (sdist)

Source distribution for logit-stream 0.5.0
File Size Uploaded Provenance Actions
logit_stream-0.5.0.tar.gz 365.2 kB With provenance Details for logit_stream-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for logit-stream 0.5.0
File Interpreter ABI Platform Actions
logit_stream-0.5.0-py3-none-any.whl Python 3 none any Details for logit_stream-0.5.0-py3-none-any.whl

Total release size: 656.1 kB

Release files / logit_stream-0.5.0.tar.gz

Download URL logit_stream-0.5.0.tar.gz
Size 365.2 kB
Tags Source
SHA-256 checksum
How to use checksums
aa5a708ed590a68b2381932e7b3d15dbaa4863482ca855320eb7a93468bc6a02
BLAKE2b-256 checksum
How to use checksums
41bc526597a816185e93086b52cd27c8f8f74ead3dbcd1cb15dac9da95efd110
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 21, 2026.

Transparency log

Release files / logit_stream-0.5.0-py3-none-any.whl

Download URL logit_stream-0.5.0-py3-none-any.whl
Size 290.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6db2107bc06f1556744ee4f01afda33b05b3fa553eaad6a6666da5d4e8c46144
BLAKE2b-256 checksum
How to use checksums
8aaeeb8280a5e1ff5744b3c8179d3a05fbadcf1d34c3a7b6f8807d3705721f89
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 21, 2026.

Transparency log

Security for logit-stream 0.5.0

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 logit_stream-0.5.0.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 21, 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