Skip to main content

econometricsmodels

CI (engine) CI (python) Docs License: MIT

A Python API providing statistical and econometric analysis methods. It is primarily intended for use as the analysis engine for economicon, a GUI application for data analysis, and its design prioritizes ease of embedding from scripts and programs (type completion, validation, dynamic construction).

  • The computational core is implemented in Rust and thinly bound to Python via PyO3.
  • Data input is restricted to polars DataFrames only, passed to the Rust side via Arrow zero-copy.
  • Formula-string parsing (e.g. y ~ x1 + x2) is not used. The dependent variable is passed as a single column name (str), independent variables as a list of column names (list[str]), and estimation options as an instance of a dedicated class.

Is this for you?

Good fit:

  • Calling estimation methods from scripts, pipelines, or GUI apps — the str/list[str] + options-object API (see above) is built for programmatic construction, not interactive formula-writing.
  • Exploratory or experimental analysis, where you value having validation (see Verification accuracy below) but don't need the full breadth of diagnostics a mature package offers.
  • Environments where a pure-Rust computational core (no system BLAS/LAPACK dependency) simplifies installation.
  • Working with large datasets, where the polars + Arrow zero-copy handoff to the Rust core (see above) avoids the extra data copy that pandas/numpy-conversion-based wrappers typically incur.
  • Projects that will lean on more than one econometric method over time — the roadmap covers a broad range (see Implementation status), all under one consistent API.

Probably not a good fit:

  • Published research or other work where correctness has to be beyond question — see the disclaimer below.
  • Workflows built around R-style formula syntax (y ~ x1 + x2); this is a deliberate design choice (see above), not a missing feature, and isn't planned.
  • Use cases that need the long tail of diagnostics, edge-case handling, and model types that statsmodels/R packages have accumulated over years of real-world use.
  • Cases where you only ever need a single method, or where install footprint is tight — this package bundles everything into one Rust-compiled extension by design, so it's not the leanest choice if you don't need the breadth.

Disclaimer

This is a solo-maintained, pre-1.0 project. Estimates are checked against statsmodels/R reference implementations (see Verification accuracy), but it has not had the years of community scrutiny and edge-case hardening that established packages have. If you're using this for an important decision — an academic paper or otherwise — we strongly recommend double-checking against a trusted, established package such as statsmodels or an R equivalent.

Installation

pip install econometricsmodels

Requires Python 3.12 or later.

Quickstart

OLS

import polars as pl
from econometricsmodels import OLS

df = pl.DataFrame(
    {
        "y": [2.1, 3.9, 6.2, 8.1, 9.8],
        "x1": [1.0, 2.0, 3.0, 4.0, 5.0],
    }
)

result = OLS(df, y="y", x=["x1"]).fit()

print(result.params)  # {"const": ..., "x1": ...}
print(result.std_errors)  # {"const": ..., "x1": ...}
print(result.r_squared)

# Row-oriented parameter table (param/coef/std_err/t_stat/p_value/conf_lower/conf_upper).
print(result.coef_table())

# Overall-fit statistics.
print(result.f_statistic, result.f_p_value)
print(result.aic, result.bic)

Logit

from econometricsmodels import Logit

df = pl.DataFrame(
    {
        "y": [0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0],
        "x1": [1.0, 1.5, 2.0, 2.5, 3.0, 3.2, 3.8, 4.0, 4.5, 5.0],
    }
)

result = Logit(df, y="y", x=["x1"]).fit()

print(result.coef_table())  # same shape as OLS, but z_stat instead of t_stat
print(result.aic, result.bic)

# Likelihood-ratio test for overall significance (the Logit/Probit analogue
# of OLS's F-statistic), plus McFadden pseudo R-squared.
print(result.lr_statistic, result.lr_p_value)
print(result.pseudo_r_squared)

Probit has the same API shape as Logit (drop-in replacement).

For more details — including how to switch to heteroskedasticity-robust standard errors (HC0-HC3), cluster-robust standard errors, HAC (Newey-West) standard errors, and Logit/Probit-specific features (marginal effects, classification tables) — see the documentation site. The full documentation, including the API reference, is published at https://masahiroyecon1997dev.github.io/econometricsmodels/.

Implementation status

Implemented: OLS (Ordinary Least Squares), WLS (Weighted Least Squares), Logit, Probit, IV (2SLS/GMM).

Planned next, in this order: Tobit → FE (Fixed Effects) → RE (Random Effects) → GLS.

During the 0.x.x pre-release period, breaking changes may occur even in minor version bumps.

Verification accuracy

Estimates for each implemented method (coefficients, standard errors, confidence intervals, AIC, BIC, log-likelihood, and the model's overall-significance test — F-statistic/p-value for OLS/WLS, likelihood-ratio statistic/p-value for Logit/Probit — plus R²/adjusted R² for OLS/WLS and McFadden pseudo R² for Logit/Probit) are verified by numerical comparison against reference implementations. In addition to a primary reference, an independent implementation is used as a cross-check.

Method cov_type Primary reference Independent cross-check
OLS / WLS classical / HC0-3 / cluster statsmodels (relative tolerance 1e-8) R (lm/lm(weights=) + sandwich/lmtest, relative tolerance 1e-8)
OLS / WLS HAC (Newey-West) statsmodels (relative tolerance 1e-8) R (relative tolerance 1e-2 for OLS, 5e-2 for WLS — looser due to differing small-sample correction conventions)
Logit / Probit classical / OPG / HC0 / cluster statsmodels (relative tolerance 1e-8) R (glm + sandwich/marginaleffects, relative tolerance ~2e-4 — looser due to differing optimizer convergence)
Logit / Probit HC1 R (glm + sandwich, relative tolerance ~2e-4) — used as the primary reference here, since statsmodels' discrete-choice models omit the n/(n-k) small-sample correction for HC1 —
IV (2SLS) classical / HC0-HC1 / cluster linearmodels (relative tolerance 1e-8) R (ivreg + sandwich/lmtest, relative tolerance 1e-8)
IV (2SLS) HAC (Newey-West) linearmodels (relative tolerance 1e-8) R (relative tolerance 1e-2, loosened to 1e-1 for a small-n scenario)
IV (2SLS / GMM) HC2/HC3 Verified against a manually-derived sandwich formula only (no cross-implementation reference: linearmodels has no HC2/HC3 for IV, and ivreg has no established leverage formula for it) —
IV (GMM) classical / HC0-HC1 / cluster / HAC linearmodels IVGMM (relative tolerance 1e-8) — (ivreg does not support GMM)

License

MIT License

Metadata

Release files for econometricsmodels 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 econometricsmodels 0.5.0
File Size Uploaded
econometricsmodels-0.5.0.tar.gz 336.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for econometricsmodels 0.5.0
File
econometricsmodels-0.5.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
econometricsmodels-0.5.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details
econometricsmodels-0.5.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
econometricsmodels-0.5.0-cp314-cp314-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.12+ x86-64 Details
econometricsmodels-0.5.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
econometricsmodels-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
econometricsmodels-0.5.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
econometricsmodels-0.5.0-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
econometricsmodels-0.5.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
econometricsmodels-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
econometricsmodels-0.5.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
econometricsmodels-0.5.0-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details

Total release size: 70.4 MB

Release files / econometricsmodels-0.5.0.tar.gz

Download URL econometricsmodels-0.5.0.tar.gz
Size 336.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e4fc8bacd13f187316d3a260157d7bfa3253a52ae1f74450fe602093b3b0fe5c
BLAKE2b-256 checksum
How to use checksums
7ec9e0fb105e01d44e638b317edf03907bab7628ddc88adb002d981ac09910c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp314-cp314-win_amd64.whl

Download URL econometricsmodels-0.5.0-cp314-cp314-win_amd64.whl
Size 5.9 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
2a59824f96dda8911fada0c09c128d09840ab3b24db6f9b6ac30660d584ce2e1
BLAKE2b-256 checksum
How to use checksums
c9c0bc175a16eb0fbdafd5a675aedf48e3cfdbf01b885281fa3d853fcb5c2a36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL econometricsmodels-0.5.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.5 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f47ac8960e795ecdaff7fa66d69e9d2493c92d5047d0a31c6f7dc58038cb226f
BLAKE2b-256 checksum
How to use checksums
025e1ce04c9e7c4649ab794855134783b391932a347ae4d778f8fd232b38be05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL econometricsmodels-0.5.0-cp314-cp314-macosx_11_0_arm64.whl
Size 5.2 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a69765e4afc5193ed832516001caad221d51a679ae5e9f4e36926477c1b6f8e1
BLAKE2b-256 checksum
How to use checksums
5e76c9221a0fbfa8976013dc5599790c0af17a0211cd270a83a2e87eca573172
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp314-cp314-macosx_10_12_x86_64.whl

Download URL econometricsmodels-0.5.0-cp314-cp314-macosx_10_12_x86_64.whl
Size 5.8 MB
Tags CPython 3.14 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0fb458cb9a7b6133c5cf47d6221f05fbdb4a7f8b1a78ce37c171bcb7ef2b120b
BLAKE2b-256 checksum
How to use checksums
76983758fe967da13083df9533fc63e6dd140d86b14216e8224de4cf58794428
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp313-cp313-win_amd64.whl

Download URL econometricsmodels-0.5.0-cp313-cp313-win_amd64.whl
Size 5.9 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
28aab7feb2799f9530247a4b64ca5952ee553e13dbcdfd1cde3839358e233c4a
BLAKE2b-256 checksum
How to use checksums
664bd759d5e189f98d5bbf3248f93091b31d100136452e90bfc1271074fa165d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL econometricsmodels-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.5 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3fbdea645f0f91d95d42fe78e80767e7d3e99e46449f59cd84e6b7acd04aebb5
BLAKE2b-256 checksum
How to use checksums
3cbab7a1405ffa383841df519a4173250e1329ec789e6e9637c0c6d6d44e2ac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL econometricsmodels-0.5.0-cp313-cp313-macosx_11_0_arm64.whl
Size 5.2 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
61967628d972d80a07b3ddcf7013ef33f1d49b37cd59f390e178761d874b7297
BLAKE2b-256 checksum
How to use checksums
cccea27a625e4f73e8f7f78fdd8f2719cda83afd4788f65d3f9d94248e473f33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp313-cp313-macosx_10_12_x86_64.whl

Download URL econometricsmodels-0.5.0-cp313-cp313-macosx_10_12_x86_64.whl
Size 5.8 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c00721c6ea673777602cf8119575399ec8b6347af8df0b6ff93918b1b5ed965d
BLAKE2b-256 checksum
How to use checksums
3223f2555c481f8a8780dec16c0c9a1150d4c9ac26ac8889b051dda3fd85e67c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp312-cp312-win_amd64.whl

Download URL econometricsmodels-0.5.0-cp312-cp312-win_amd64.whl
Size 5.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
adda32c2fb274f896dffcd53343420b634567406794a925292dbd7b87b9e4970
BLAKE2b-256 checksum
How to use checksums
b64084761864623cc7ec71c4c83525e87760953d558eb713f20feaa950d35269
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL econometricsmodels-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.5 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d3e00a039ef87db5c3d5a44bc617ff7cadfb9c4d9aad3a0533561ba20d04cb50
BLAKE2b-256 checksum
How to use checksums
cd5ce97bbbd6fd08ba870b28d6ca874cb429170aae90cbaa068b9e8a54ff595b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL econometricsmodels-0.5.0-cp312-cp312-macosx_11_0_arm64.whl
Size 5.2 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2421f3a2852febf66cda59bc73f09c0055d09fa4cb03954c4cb0bc27503c8398
BLAKE2b-256 checksum
How to use checksums
bf2c9d557c3a0fbe8e6bd49b0b326ae8c64ec51de137d04b9b094d56469ba03a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release files / econometricsmodels-0.5.0-cp312-cp312-macosx_10_12_x86_64.whl

Download URL econometricsmodels-0.5.0-cp312-cp312-macosx_10_12_x86_64.whl
Size 5.8 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
af28d71496998db9f942c1be7145b48811e7aed3f175e68b655271c40bdf198e
BLAKE2b-256 checksum
How to use checksums
abef3ee6f5b10cd99ac5852dca6bd17145f5bd50ce125f7fb3975228ae53467c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 15, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.0

13 release files

This release

0.5.0 This release

13 release files

0.2.0

13 release files

0.1.0

13 release files

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