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 or random intercepts.

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
mixlogit_stream, nlogit_stream mixed and nested logit (prototypes)

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.

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/).

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 a runnable script for each page of its guide, 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.4.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.4.0
File Size Uploaded Provenance Actions
logit_stream-0.4.0.tar.gz 224.0 kB With provenance Details for logit_stream-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 406.2 kB

Release files / logit_stream-0.4.0.tar.gz

Download URL logit_stream-0.4.0.tar.gz
Size 224.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4624d3971f2a2ec3c30cc249019f4c1ae64b1177cddb765d870355ab4ad59fe8
BLAKE2b-256 checksum
How to use checksums
45baacbddb72581187803e8e28836c1728f55c05cbe3a7fb96636f50573312b7
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 11, 2026.

Transparency log

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

Download URL logit_stream-0.4.0-py3-none-any.whl
Size 182.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f9c284bf03dacfb0a6525a4748cfbc9f5cf8255eb48352fb3913f3acf3af6d2
BLAKE2b-256 checksum
How to use checksums
3353ff5926d112bad261e8b81f2595ea7e831d7a1ffe5a3430b734ba12d5e325
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 11, 2026.

Transparency log

Security for logit-stream 0.4.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.4.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 11, 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