This release is a pre-release and may not be stable for production use.
qte — Quantile Treatment Effects in Python
Alpha software: the API may change without notice between releases.
This is a Python implementation of a collection of quantile treatment effect estimators inspired by
the R qte package and the Stata
ivqte
package. See the project website for the API reference and
benchmarks.
The available estimators are
- Unconfounded quantile treatment effects — unadjusted, inverse probability weighted, outcome regression and doubly robust;
- distributional difference-in-differences — changes-in-changes and quantile difference-in-differences; and
- instrumental variables — local quantile treatment effects for compliers; and
- regression discontinuity — local quantile treatment effects for compliers by local distribution regression.
Other features:
- Fast:
py-qteuses more efficient algorithms and parallelizes the bootstrap standard errors effectively. On larger datasets it is more than 20× faster thanqtefor the AIPW estimator of the quantile treatment effect (see the benchmark timings). - Beautiful: Graphs and tables for the console, the web, and LaTeX powered by Altair, Great Tables and Rich.
Installation
Requires Python 3.12 or newer.
uv add py-qte # or pip install py-qte
On Linux and macOS the Fortran solver for quantile regression should work and be used in the
computations. On Windows a fallback (based on the statsmodels library) will be used.
Examples
Unconfounded Data
We can estimate quantile treatment (and average) treatment effects using an augmented inverse probability weighting (AIPW) estimator.
from qte.unconfounded import estimate_aipw_effects
from qte.datasets import load_lalonde
ds = load_lalonde()
res = estimate_aipw_effects(
ds=ds,
outcome="re78",
treatment="treat",
outcome_regression_config="age + education",
propensity_score_formula="age + education",
)
res.plot() # Vega-Altair plot (see below)
res.tabulate() # Great Tables output (see below)
|
|
|
Distributional Difference-in-Differences
We can estimate quantile treatment (and average) treatment effects with the changes-in-changes estimator.
from qte.distributional_did import TrtGroupConfig, estimate_changes_in_changes_effects
from qte.datasets import load_mpdta
ds = load_mpdta()
res = estimate_changes_in_changes_effects(
ds,
"lemp",
TrtGroupConfig("first.treat", 0), # never-treated group is 0
"year",
"countyreal",
qs=[0.25, 0.5, 0.75],
)
|
|
|
Instrumental Variables
We can also estimate local quantile treatment effects for compliers when the treatment is endogenous.
from qte.datasets import load_card
from qte.iv import estimate_unconditional_local_effects
ds = load_card()
res = estimate_unconditional_local_effects(
ds,
outcome="lwage",
treatment="college",
instrument="nearc4",
qs=[0.1, 0.25, 0.5, 0.75, 0.9],
)
res.plot() # Vega-Altair plot
res.tabulate() # Great Tables output
Regression Discontinuity Design
We can estimate local quantile treatment effects for compliers at a cutoff with local distribution regression.
import polars as pl
from qte.bootstrap import BootstrapMultiplierConfig
from qte.datasets import load_ddk_2011
from qte.rdd import LocalPolynomialConfig, RunningVariableConfig, estimate_rdd_distribution_effects
ds = load_ddk_2011().filter(pl.col("tracking") == 1).drop_nulls(["ts_std", "percentile"])
res = estimate_rdd_distribution_effects(
ds,
outcome="ts_std",
treatment="highstream",
running_variable=RunningVariableConfig("percentile", 50.0),
qs=[0.1, 0.25, 0.5, 0.75, 0.9],
local_polynomial_config=LocalPolynomialConfig(bandwidth=20.0),
bootstrap_config=BootstrapMultiplierConfig(n_draws=2500, seed=42),
)
res.plot(band="uniform") # Vega-Altair plot
res.tabulate() # Great Tables output
|
|
|
Development
Development is somewhat complicated due to the inclusion of the Fortran code for solving quantile regression. A working way to set up the project for development is:
git clone git@github.com:mohelm/py-qte.git
cd py-qte
uv sync --all-groups --no-install-project && uv sync --all-groups
Website
See docs/README.md for how to build
and preview the Quarto website and regenerate the API reference.
Regenerating the README assets
Regenerate the figures above after changing the estimators or their presentation:
uv run python -m docs.readme
README_PYPI.md (what project.readme points at) is generated from this file with relative links
made absolute, since PyPI can't resolve repo-relative assets. Regenerate it after editing this file:
uv run python -m docs.readme --pypi-readme-only
Releasing
See RELEASING.md for how to cut a
release.
Credits
The unconfounded and distributional difference-in-differences estimators reimplement the R
qte package by Brantly Callaway. The instrumental-variables
estimator roughly follows the Stata
ivqte
package by Frölich and Melly. The regression-discontinuity estimator reimplements the Stata
rddqte package of Frandsen, Frölich and Melly.
License
This project is licensed under GPL-3.0-or-later. The Frisch-Newton quantile-regression solver under
src/qte/quantile_regression/_ext/rqfnb.f is directly derived from the R
quantreg package by Roger Koenker, which is
licensed GPL (>= 2). The project would need a clean-room reimplementation of that Fortran solver
before it could move to a permissive license.
Metadata
Release files for py-qte 0.1.0a3
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 |
|---|---|---|---|---|
| py_qte-0.1.0a3.tar.gz | 1.1 MB | With provenance | Details for py_qte-0.1.0a3.tar.gz |
Built distributions (wheels)
Total release size: 23.3 MB
Release files / py_qte-0.1.0a3.tar.gz
| Download URL | py_qte-0.1.0a3.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18204bd4674817c7230e39d2723a55c7545cc4bc0aa1d95cd33dde2fb950af54
|
|
BLAKE2b-256 checksum How to use checksums |
98607c3a57876387eedb7fb0c718999975e966c003aaf9eb3790592fb540eb23
|
| 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 27, 2026.
Transparency logRelease files / py_qte-0.1.0a3-py3-none-any.whl
| Download URL | py_qte-0.1.0a3-py3-none-any.whl |
|---|---|
| Size | 846.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b46a6873966ce3eaa0082cab7eb943a64a9d378ee796b54319d2bff3e9a9c78
|
|
BLAKE2b-256 checksum How to use checksums |
e46bc986282d383130cd0efd853401cc57349307b54c46b9b6c8948a092e6fe0
|
| 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 27, 2026.
Transparency logRelease files / py_qte-0.1.0a3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | py_qte-0.1.0a3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
17f3fe6416055effeebacc0412ce113fa74f7169c2f9c41ed584d78fd72c1a71
|
|
BLAKE2b-256 checksum How to use checksums |
45a4ba2fb2400755cd6b220ca344a7f5d2312ec6561fe4d5a290e40e602db090
|
| 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 27, 2026.
Transparency logRelease files / py_qte-0.1.0a3-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | py_qte-0.1.0a3-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 870.1 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6e5942ba1922c3649969985ef043ed0182ce37be102f132b9f23e78cb207febf
|
|
BLAKE2b-256 checksum How to use checksums |
08c269cd7186ab0f406e4db1b9d515f0ac30cea60817962ae34a444ba2b91461
|
| 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 27, 2026.
Transparency logRelease files / py_qte-0.1.0a3-cp314-cp314-macosx_10_15_x86_64.whl
| Download URL | py_qte-0.1.0a3-cp314-cp314-macosx_10_15_x86_64.whl |
|---|---|
| Size | 871.2 kB |
| Tags | CPython 3.14 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
bbfe7becfcad5fbf5f8ee645f7ea4e76eaa36e199f7d2615c267432d7f43e267
|
|
BLAKE2b-256 checksum How to use checksums |
00257490a33689c53668f3d0484a0f02a3494f8d09ce582d900a270d87e88102
|
| 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 27, 2026.
Transparency logRelease files / py_qte-0.1.0a3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | py_qte-0.1.0a3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
72a61e8557ebf81b16410cd3d17ce6261a2be642025ed4db4d4c45634b89b592
|
|
BLAKE2b-256 checksum How to use checksums |
22a6f00b4347e55963632f40fb7c06bceb92ec3a9e2de96ebb5e0d6c5a56a367
|
| 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 27, 2026.
Transparency logRelease files / py_qte-0.1.0a3-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | py_qte-0.1.0a3-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 870.2 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bc241d6c43dc03c602d21aea2e28bb54f3e11c8d6ac3bb34d1957e7df350ae49
|
|
BLAKE2b-256 checksum How to use checksums |
67249f3a18c34e13ada1fade665289bc4c38e15fe643b468e2e7453e2998d998
|
| 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 27, 2026.
Transparency logRelease files / py_qte-0.1.0a3-cp313-cp313-macosx_10_13_x86_64.whl
| Download URL | py_qte-0.1.0a3-cp313-cp313-macosx_10_13_x86_64.whl |
|---|---|
| Size | 871.2 kB |
| Tags | CPython 3.13 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
e82d4a88c74c6c52be3738c246be1496435efd50719cc0f2201f6631933dc4c1
|
|
BLAKE2b-256 checksum How to use checksums |
eb57b2622ac50aef6a561af8388e287154145fef6b345929c8d665856ca046b5
|
| 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 27, 2026.
Transparency logRelease files / py_qte-0.1.0a3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | py_qte-0.1.0a3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
3afbdb35a7396dbfc0ff2c985a70e5840beed2a31452c354ba04ead6c69cf6ba
|
|
BLAKE2b-256 checksum How to use checksums |
58463f94c9985061200006f8825b4bb200b4b3539c54beea910a3e03850b4068
|
| 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 27, 2026.
Transparency logRelease files / py_qte-0.1.0a3-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | py_qte-0.1.0a3-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 870.2 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
79d907d406f025db6a6cbac4e164bbabf583664a04b0408750614b3dad2abcb6
|
|
BLAKE2b-256 checksum How to use checksums |
26ead6decc99e52306f285003424ccbee041344d1c0cd2efda23bdc036aebe48
|
| 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 27, 2026.
Transparency logRelease files / py_qte-0.1.0a3-cp312-cp312-macosx_10_13_x86_64.whl
| Download URL | py_qte-0.1.0a3-cp312-cp312-macosx_10_13_x86_64.whl |
|---|---|
| Size | 871.2 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
4e495a24e5d4dbb0466ef65bf94ac5b5cc6b3ce1a1a1dedcbb96c2e8f4a659a9
|
|
BLAKE2b-256 checksum How to use checksums |
57fb22821a5bbb7a0bcba774d34dfe5ffb97aba93b3107beca8bf631e401debe
|
| 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 27, 2026.
Transparency logSecurity for py-qte 0.1.0a3
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
All 11 files in this release have been uploaded with provenance metadata.
Attestation for py_qte-0.1.0a3.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 27, 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.