nprobust
Python implementation of the R package nprobust: Nonparametric Robust Estimation and Inference Methods using Local Polynomial Regression and Kernel Density Estimation.
Description
This package provides tools for data-driven statistical analysis using local polynomial regression and kernel density estimation methods as described in:
- Calonico, Cattaneo and Farrell (2018): "On the Effect of Bias Estimation on Coverage Accuracy in Nonparametric Inference", Journal of the American Statistical Association.
- Calonico, Cattaneo and Farrell (2019): "nprobust: Nonparametric Kernel-Based Estimation and Robust Bias-Corrected Inference", Journal of Statistical Software.
Installation
pip install nprobust .
Or with plotting support:
Main Functions
- lprobust: Local polynomial point estimation and robust bias-corrected inference
- lpbwselect: Bandwidth selection for local polynomial regression
- kdrobust: Kernel density point estimation and robust bias-corrected inference
- kdbwselect: Bandwidth selection for kernel density estimation
- nprobust_plot: Plotting function for estimation results
Basic Usage
import numpy as np
from nprobust import lprobust, lpbwselect, kdrobust, kdbwselect, nprobust_plot
# Generate sample data
np.random.seed(42)
n = 500
x = np.random.uniform(0, 1, n)
y = np.sin(2 * np.pi * x) + np.random.normal(0, 0.5, n)
# Local polynomial regression
result = lprobust(y, x)
result.summary()
# Bandwidth selection
bw = lpbwselect(y, x, bwselect="mse-dpi")
bw.summary()
# Kernel density estimation
kd_result = kdrobust(x)
kd_result.summary()
# Plotting
fig = nprobust_plot(result, title="Local Polynomial Regression")
Parameters
lprobust
y: Response variablex: Independent variableeval: Evaluation points (default: 30 equally spaced points)p: Polynomial order (default: 1)deriv: Order of derivative (default: 0)h: Bandwidth (default: data-driven selection)kernel: Kernel function ('epa', 'uni', 'tri', 'gau')bwselect: Bandwidth selection method ('mse-dpi', 'imse-dpi', etc.)vce: Variance estimator ('nn', 'hc0', 'hc1', 'hc2', 'hc3')
kdrobust
x: Data vectoreval: Evaluation pointsh: Bandwidthkernel: Kernel function ('epa', 'uni', 'gau')bwselect: Bandwidth selection method
References
- Calonico, S., M. D. Cattaneo, and M. H. 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, S., M. D. Cattaneo, and M. H. Farrell (2019). "nprobust: Nonparametric Kernel-Based Estimation and Robust Bias-Corrected Inference." Journal of Statistical Software 91(8): 1-33.
License
GPL-2
Original R Package
Metadata
Release files for nprobust 0.5.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-0.5.0.tar.gz | 23.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nprobust-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 47.8 kB
Release files / nprobust-0.5.0.tar.gz
| Download URL | nprobust-0.5.0.tar.gz |
|---|---|
| Size | 23.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46afa8e9917adc2041ee52c121843c4a31cdb8435a0060b9aaee94c888b4f23e
|
|
BLAKE2b-256 checksum How to use checksums |
0eaaff84beea379c4587a1528efbe88e95b729af42678e7613bb780bfa4feb97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jan 20, 2026.
Transparency logRelease files / nprobust-0.5.0-py3-none-any.whl
| Download URL | nprobust-0.5.0-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6d8d08783d42dbafd0c07bc938e8cd88c476267f4d0b5218aedafd647104742
|
|
BLAKE2b-256 checksum How to use checksums |
e45ea77bb40471d6ca28b375acd7b4bd38fbc25c9e07556c8f94739701544457
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jan 20, 2026.
Transparency log