This is an attempt at a Python implementation of the qte R package by Brantly Callaway from here.
The main features are:
- Availability of cross-sectional quantile treatment effects and quantile treatment effects on the treated estimators (simple ,IPW, outcome regression, doubly robust);
- Fast:
- as opposed to the R-package we can use highly optimized Numpy functions for computing weighted quantiles;
- quantile regression is magnitudes faster than in other Python packages since we use highly optimized Fortran code directly;
- parallelism for bootstrapped standard errors;
- batching and vectorization in performance critical places;
- built natively on Polars;
- Beautiful: Graphs and tables for the console, the web, and latex powered by Altair, Great Tables and Rich.
import polars as pl
from qte.cross_sectional import estimate_aipw_qte
df = pl.read_csv("lalonde.csv")
res = estimate_aipw_qte(
ds=df,
outcome_c="re78",
treatment_c="treat",
or_x_formular="age + education",
ps_x_formular="age + education",
)
print(res)