Skip to main content
Pre-release

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 some of the estimators in the qte R package by Brantly Callaway (link). See the project website for the API reference and benchmarks.

The main features are:

  • Cross-sectional quantile treatment effects estimators (unadjusted, inverse probability weighted, outcome regression, doubly robust) and a nonlinear difference-in-differences estimator (changes-in-changes and quantile difference-in-differences).
  • Fast: py-qte uses more efficient algorithms and parallelizes the bootstrap standard errors effectively. On larger datasets it is more than 20× faster than qte for 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

Cross-Sectional Data

We can estimate quantile treatment (and average) treatment effects using an augmented inverse probability weighting (AIPW) estimator.

from qte.cross_sectional 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_formula="age + education",
    propensity_score_formula="age + education",
)

res.plot()  # Vega-Altair plot (see below)
res.tabulate()  # Great Tables output (see below)

Nonlinear Difference-in-Differences

We can estimate quantile treatment (and average) treatment effects with the changes-in-changes estimator.

from qte.nonlinear_did import (
    CounterfactualModel,
    TrtGroupConfig,
    estimate_nonlinear_did_for_panel,
)
from qte.datasets import load_mpdta

ds = load_mpdta()
res = estimate_nonlinear_did_for_panel(
    ds,
    "lemp",
    TrtGroupConfig("first.treat", 0),  # never-treated group is 0
    "year",
    "countyreal",
    qs=[0.25, 0.5, 0.75],
    counterfactual_model=CounterfactualModel.CIC,
)

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.

Metadata

Release files for py-qte 0.1.0a2

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

Source distribution (sdist)

Source distribution for py-qte 0.1.0a2
File Size Uploaded
py_qte-0.1.0a2.tar.gz 316.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for py-qte 0.1.0a2
File
py_qte-0.1.0a2-py3-none-any.whl Python 3 none any Details
py_qte-0.1.0a2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
py_qte-0.1.0a2-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
py_qte-0.1.0a2-cp314-cp314-macosx_10_15_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.15+ x86-64 Details
py_qte-0.1.0a2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
py_qte-0.1.0a2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
py_qte-0.1.0a2-cp313-cp313-macosx_10_13_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.13+ x86-64 Details
py_qte-0.1.0a2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
py_qte-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
py_qte-0.1.0a2-cp312-cp312-macosx_10_13_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.13+ x86-64 Details

Total release size: 15.7 MB

Release files / py_qte-0.1.0a2.tar.gz

Download URL py_qte-0.1.0a2.tar.gz
Size 316.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bdca14cef2ce285f2bc4692e9859effafec124d26c79d2ff035de71eaee3bb6a
BLAKE2b-256 checksum
How to use checksums
a82a0bce2463e12457d7d4aaad44f9a5856402cd3c8ac9386040742854404beb
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 Oct 3, 2026.

Transparency log

Release files / py_qte-0.1.0a2-py3-none-any.whl

Download URL py_qte-0.1.0a2-py3-none-any.whl
Size 164.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91cbfb3ee1fffb101d6518e74c6159510f8f38824c075ddc30bdebe114a472c3
BLAKE2b-256 checksum
How to use checksums
130b714e40d606a79becf2ac332838d3dc6d603b010db5a27d6531d06cb56528
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 Oct 3, 2026.

Transparency log

Release files / py_qte-0.1.0a2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL py_qte-0.1.0a2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 4.7 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
0a52db302dcd4f5e6f393a63e2cad472e969881a99b73803cafeaa0f3ce5dcbd
BLAKE2b-256 checksum
How to use checksums
7f603e5f97f679114a7570b4695f500a36b9116f27ea5e9e5b3c812a9da448bc
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 Oct 3, 2026.

Transparency log

Release files / py_qte-0.1.0a2-cp314-cp314-macosx_11_0_arm64.whl

Download URL py_qte-0.1.0a2-cp314-cp314-macosx_11_0_arm64.whl
Size 187.4 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1f138d993a02ba213405c1a7afe2a472437a868adbb0066a246d076dd8e18300
BLAKE2b-256 checksum
How to use checksums
2647755fa684083adb98d85178b20acd0ddcbcac2eb2ac514a03694daf16aea3
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 Oct 3, 2026.

Transparency log

Release files / py_qte-0.1.0a2-cp314-cp314-macosx_10_15_x86_64.whl

Download URL py_qte-0.1.0a2-cp314-cp314-macosx_10_15_x86_64.whl
Size 188.6 kB
Tags CPython 3.14 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
c494b4f53e71441f82b41f032e6767cffb7d39580891f31bf2b4c51696337749
BLAKE2b-256 checksum
How to use checksums
5ace056f44dd39c3ebc0abdf88f5e52ad1e4b6aba193dc8387658ad238864d23
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 Oct 3, 2026.

Transparency log

Release files / py_qte-0.1.0a2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL py_qte-0.1.0a2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 4.7 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a0838c3fb9ed591b6cfd10541f67fbd4c95282f281d87a28182d9578b202acf2
BLAKE2b-256 checksum
How to use checksums
6b618e71c45b420507d6d359d531531be644a96ab2c5949d77986f39a95e5582
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 Oct 3, 2026.

Transparency log

Release files / py_qte-0.1.0a2-cp313-cp313-macosx_11_0_arm64.whl

Download URL py_qte-0.1.0a2-cp313-cp313-macosx_11_0_arm64.whl
Size 187.5 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bac554b1773f4bd1af696fc671ab619144fdb46cd927c3b5a4c1f539f71607da
BLAKE2b-256 checksum
How to use checksums
1963a4cd89e79202172e5ea6651dd2db290b94f3e9f268ff455bc7522d393ac0
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 Oct 3, 2026.

Transparency log

Release files / py_qte-0.1.0a2-cp313-cp313-macosx_10_13_x86_64.whl

Download URL py_qte-0.1.0a2-cp313-cp313-macosx_10_13_x86_64.whl
Size 188.5 kB
Tags CPython 3.13 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
07da3e22d25cd9975aa979634c93a9386169b536bdf59b7ff48a097b9c602c45
BLAKE2b-256 checksum
How to use checksums
583c26b2a026f9a1c3120f34d00c9349ae14589ace052a8193bc8a825a70db68
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 Oct 3, 2026.

Transparency log

Release files / py_qte-0.1.0a2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL py_qte-0.1.0a2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 4.7 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ed37aa256cc8ffb775b37bccca56f355e4975ff19f0564d8c2457a5af97d9048
BLAKE2b-256 checksum
How to use checksums
d5064e883f960a689eefe1910caecbb68dcee4b3f6a3ca67041a265f4d49fb7e
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 Oct 3, 2026.

Transparency log

Release files / py_qte-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl

Download URL py_qte-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl
Size 187.5 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6b160bffedbe4a1c6f2f1fc4af25698ba1d9566eb00554230b0948f61f6f8c5d
BLAKE2b-256 checksum
How to use checksums
6fd4a218826b68fce9367f1c9914f6f6664a8595846d0bbc36ed996df33d68d3
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 Oct 3, 2026.

Transparency log

Release files / py_qte-0.1.0a2-cp312-cp312-macosx_10_13_x86_64.whl

Download URL py_qte-0.1.0a2-cp312-cp312-macosx_10_13_x86_64.whl
Size 188.5 kB
Tags CPython 3.12 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
d4b26b4235c8a5f105256c3b56af8ff156b998464ba13208c08d86629514e6a3
BLAKE2b-256 checksum
How to use checksums
f9686144d0f55dcfcc53016bf89e7e1f646043049e9f50baf92efc33db55e830
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 Oct 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0a2 This release

11 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