fastLP#
Fast panel local projections for applied macroeconomists.
fastLP is a Python library for quickly estimating panel local projections. It combines a beginner-friendly interface with a Rust core and reuses transformed designs across horizons when the regression sample permits it.
What it supports#
pandas, Polars, and NumPy inputs
level and cumulative responses
generates outcome, shock, and control lags
absorbs complex fixed effects efficiently
homoskedastic, HC0–HC3, clustered, HAC/Newey–West, and Driscoll–Kraay covariance estimators
tidy results and impulse-response plots
Performance#
Median time to estimate 12 horizons on a balanced panel with 5,000 units and 40 periods. Whiskers are 95% percentile bootstrap confidence intervals. The comparison procedure is available in the benchmark directory.#
Installation#
Get fastLP from PyPI or uv:
pip install fastlp-py
uv add fastlp-py
Install the optional Polars input backend with:
pip install "fastlp-py[polars]"
uv add "fastlp-py[polars]"
fastLP requires Python 3.12 or later. Wheels include the compiled Rust extension.
Where to begin#
Read the quickstart for a complete first estimation. The API reference lists the estimator, results helpers, and plotting function.
Note
fastLP is an early release. Validate results against an independent estimator for consequential empirical work and review the reported sample and numerical diagnostics.
Contributing, similar libraries, and more#
The author and maintainer is Ritwiz Sarma (CAFRAL, Reserve Bank of India). For comments or brickbats, please email me or leave an issue.
I was inspired to make something like this after using diff-diff,
igerber’s excellent package for
difference-in-difference estimation. The Rust core and scikit-learn-style API
are all attempts to emulate that design. Midway through building this library,
I also came upon cacoleman’s tsecon library,
which has a similar design but packs a lot of different time-series estimation
utilities in one library, including LP. I recommend both these libraries!
PRs welcome. Feel free to fork, extend, and build new things with this library.