Kernel Density and Local Polynomial Regression Methods
The package nprobust implements estimation, inference, bandwidth selection,
and graphical procedures for kernel density and local polynomial regression
methods, including robust bias-corrected confidence intervals.
lprobust: local polynomial point estimation and robust bias-corrected inference.lpbwselect: data-driven bandwidth selection for local polynomial regression.kdrobust: kernel density point estimation and robust bias-corrected inference.kdbwselect: data-driven bandwidth selection for kernel density estimation.
See references for methodological and practical details.
Website: https://nppackages.github.io/.
Source code: https://github.com/nppackages/nprobust.
Authors
Sebastian Calonico (scalonico@ucdavis.edu)
Matias D. Cattaneo (matias.d.cattaneo@gmail.com)
Max H. Farrell (mhfarrell@gmail.com)
Installation
To install/update use pip:
pip install nprobust_pkg
Usage
from pathlib import Path
import pandas as pd
from nprobust import kdrobust, kdbwselect, lprobust, lpbwselect, plot_lprobust
# Cholesterol trial data used by the R and Stata examples.
data = pd.read_csv(Path("..") / "nprobust_data.csv")
control = data["t"] == 0
# Local polynomial regression with robust bias-corrected confidence intervals.
result = lprobust(data.loc[control, "cholf"], data.loc[control, "chol1"])
print(result.summary())
# Data-driven bandwidth selection.
bw = lpbwselect(data.loc[control, "cholf"], data.loc[control, "chol1"],
bwselect="mse-dpi", neval=7)
print(bw.bws)
# Kernel density estimation.
density = kdrobust(data.loc[control, "chol1"], neval=30)
print(density.summary())
# Kernel density bandwidth selection.
print(kdbwselect(data.loc[control, "chol1"], bwselect="imse-dpi").bws)
# Plot a local polynomial fit.
fig = plot_lprobust(result, xlabel="chol1", ylabel="cholf")
fig.savefig("fit.png")
- Replication: nprobust illustration, nprobust data.
Dependencies
- numpy
- pandas
- scipy
- matplotlib (optional plotting extra)
References
For overviews and introductions, see nppackages website.
Software and Implementation
- Calonico, Cattaneo and Farrell (2019): nprobust: Nonparametric Kernel-Based Estimation and Robust Bias-Corrected Inference.
Journal of Statistical Software 91(8): 1-33.
Technical and Methodological
-
Calonico, Cattaneo and Farrell (2018): On the Effect of Bias Estimation on Coverage Accuracy in Nonparametric Inference.
Journal of the American Statistical Association 113(522): 767-779. -
Calonico, Cattaneo and Farrell (2022): Coverage Error Optimal Confidence Intervals for Local Polynomial Regression.
Bernoulli 28(4): 2998-3022.
Release files for nprobust-pkg 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nprobust_pkg-1.0.0.tar.gz | 33.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nprobust_pkg-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 69.2 kB
Release files / nprobust_pkg-1.0.0.tar.gz
| Download URL | nprobust_pkg-1.0.0.tar.gz |
|---|---|
| Size | 33.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e3eb166143992bf7c75c7c29624071ea04b172a0c6ac82a34d97258dff2d6d1
|
|
BLAKE2b-256 checksum How to use checksums |
3b0970e6eafcfdd48a65e43e820481c6147ff56c308fbf6acaae33db0cc418db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 17, 2026.
Transparency logRelease files / nprobust_pkg-1.0.0-py3-none-any.whl
| Download URL | nprobust_pkg-1.0.0-py3-none-any.whl |
|---|---|
| Size | 36.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1353105fc7368a0c666001cd353d0f72aab3c2d5900a2f1558679dd95a017049
|
|
BLAKE2b-256 checksum How to use checksums |
fb6b357c4ace54c52cdf93df2c3e359130a79ddba8e9032f56b82c08e5d1df75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 17, 2026.
Transparency log