Skip to main content

Nonparametric Robust Estimation and Inference Methods

Project description

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 variable
  • x: Independent variable
  • eval: 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 vector
  • eval: Evaluation points
  • h: Bandwidth
  • kernel: 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

https://github.com/nppackages/nprobust

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-0.5.0.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

nprobust-0.5.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file nprobust-0.5.0.tar.gz.

File metadata

  • Download URL: nprobust-0.5.0.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nprobust-0.5.0.tar.gz
Algorithm Hash digest
SHA256 46afa8e9917adc2041ee52c121843c4a31cdb8435a0060b9aaee94c888b4f23e
MD5 5ef659dc1bc1297ce10c1bf5ba18d70d
BLAKE2b-256 0eaaff84beea379c4587a1528efbe88e95b729af42678e7613bb780bfa4feb97

See more details on using hashes here.

Provenance

The following attestation bundles were made for nprobust-0.5.0.tar.gz:

Publisher: publish.yml on anzonyquispe/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-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: nprobust-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nprobust-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b6d8d08783d42dbafd0c07bc938e8cd88c476267f4d0b5218aedafd647104742
MD5 101df26c179660429bd6bf3a26858087
BLAKE2b-256 e45ea77bb40471d6ca28b375acd7b4bd38fbc25c9e07556c8f94739701544457

See more details on using hashes here.

Provenance

The following attestation bundles were made for nprobust-0.5.0-py3-none-any.whl:

Publisher: publish.yml on anzonyquispe/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