Estimation, inference, bandwidth selection, and graphical procedures for kernel density and local polynomial regression methods.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nprobust_pkg-1.0.0.tar.gz.
File metadata
- Download URL: nprobust_pkg-1.0.0.tar.gz
- Upload date:
- Size: 33.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e3eb166143992bf7c75c7c29624071ea04b172a0c6ac82a34d97258dff2d6d1
|
|
| MD5 |
563e802e3269759c2cfecbee465d15e2
|
|
| BLAKE2b-256 |
3b0970e6eafcfdd48a65e43e820481c6147ff56c308fbf6acaae33db0cc418db
|
Provenance
The following attestation bundles were made for nprobust_pkg-1.0.0.tar.gz:
Publisher:
publish-python.yml on nppackages/nprobust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nprobust_pkg-1.0.0.tar.gz -
Subject digest:
0e3eb166143992bf7c75c7c29624071ea04b172a0c6ac82a34d97258dff2d6d1 - Sigstore transparency entry: 1564735143
- Sigstore integration time:
-
Permalink:
nppackages/nprobust@1b8847cf55b116a9d28419d1a297862f99b4c859 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nppackages
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@1b8847cf55b116a9d28419d1a297862f99b4c859 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file nprobust_pkg-1.0.0-py3-none-any.whl.
File metadata
- Download URL: nprobust_pkg-1.0.0-py3-none-any.whl
- Upload date:
- Size: 36.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1353105fc7368a0c666001cd353d0f72aab3c2d5900a2f1558679dd95a017049
|
|
| MD5 |
9df3715153fc0ff380a9f6e10e37026b
|
|
| BLAKE2b-256 |
fb6b357c4ace54c52cdf93df2c3e359130a79ddba8e9032f56b82c08e5d1df75
|
Provenance
The following attestation bundles were made for nprobust_pkg-1.0.0-py3-none-any.whl:
Publisher:
publish-python.yml on nppackages/nprobust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nprobust_pkg-1.0.0-py3-none-any.whl -
Subject digest:
1353105fc7368a0c666001cd353d0f72aab3c2d5900a2f1558679dd95a017049 - Sigstore transparency entry: 1564735145
- Sigstore integration time:
-
Permalink:
nppackages/nprobust@1b8847cf55b116a9d28419d1a297862f99b4c859 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nppackages
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@1b8847cf55b116a9d28419d1a297862f99b4c859 -
Trigger Event:
workflow_dispatch
-
Statement type: