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.6.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.6.0
File Size Uploaded Provenance Actions
logit_stream-0.6.0.tar.gz 373.2 kB With provenance Details for logit_stream-0.6.0.tar.gz

Built distribution (wheel)

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

Total release size: 670.8 kB

Release files / logit_stream-0.6.0.tar.gz

Download URL logit_stream-0.6.0.tar.gz
Size 373.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e4bb7a8053908b9e2ff1f2e7f9fbc9c78823375414d7f2c40e08fcc668e76f44
BLAKE2b-256 checksum
How to use checksums
5ebd94a72298d9c11e56fa6c3206f71c9272da7ce93ceed11c64adad978b9c1e
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 22, 2026.

Transparency log

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

Download URL logit_stream-0.6.0-py3-none-any.whl
Size 297.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
356809b0d6d913b24aedbcf543430b28cbb705b2d095dbf296004f2b3db1d0e5
BLAKE2b-256 checksum
How to use checksums
3841eabd36e53bbea681043283c30ab266ec46f5ff70cd4eac609f1fa603ae4b
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 22, 2026.

Transparency log

Security for logit-stream 0.6.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.6.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 22, 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