Skip to main content

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")

Dependencies

  • numpy
  • pandas
  • scipy
  • matplotlib (optional plotting extra)

References

For overviews and introductions, see nppackages website.

Software and Implementation

Technical and Methodological



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nprobust_pkg-1.0.0.tar.gz (33.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nprobust_pkg-1.0.0-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

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

Hashes for nprobust_pkg-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0e3eb166143992bf7c75c7c29624071ea04b172a0c6ac82a34d97258dff2d6d1
MD5 563e802e3269759c2cfecbee465d15e2
BLAKE2b-256 3b0970e6eafcfdd48a65e43e820481c6147ff56c308fbf6acaae33db0cc418db

See more details on using hashes here.

Provenance

The following attestation bundles were made for nprobust_pkg-1.0.0.tar.gz:

Publisher: publish-python.yml on nppackages/nprobust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for nprobust_pkg-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1353105fc7368a0c666001cd353d0f72aab3c2d5900a2f1558679dd95a017049
MD5 9df3715153fc0ff380a9f6e10e37026b
BLAKE2b-256 fb6b357c4ace54c52cdf93df2c3e359130a79ddba8e9032f56b82c08e5d1df75

See more details on using hashes here.

Provenance

The following attestation bundles were made for nprobust_pkg-1.0.0-py3-none-any.whl:

Publisher: publish-python.yml on nppackages/nprobust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page