KernReg
Introduction
KernReg provides a pure-Python routine for local polynomial kernel regression based on Wand & Jones (1995) and their accompanying R package KernSmooth. In addition, KernReg comes with an automatic bandwidth selection procedure that minimizes the residual squares criterion proposed by Fan & Gijbels (1996).
KernReg allows for the estimation of a regression function as well as their vth derivatives. The degree of the polynomial p must be equal to v + 1,
v + 3, v + 5, or v + 7.
Local polynomial fitting provides a simple way of finding a functional relationship between two variables (where X typically denotes the predictor, and Y the response variable) without the imposition of a parametric model. It is a natural extension of local mean smoothing, as described by Nadaraya (1964) and Watson (1964). Instead of fitting a local mean, local polynomial smooting involves fitting a local pth-order polynomial via locally weighted least-squares. The Nadaraya–Watson estimator is thus equivalent to fitting a local polynomial of degree zero. Local polynomials of higher order have better bias properties and, in general, do not require bias adjustment at the boundaries of the regression space.
Installation
Install KernReg via PyPI.
$ pip install kernreg
Quick-Start
import kernreg as kr
motorcycle = kr.get_example_data()
x, y = motorcycle["time"], motorcycle["accel"]
# By default, only x and y need to be provided.
# Derivative = 0 is chosen by default
# and hence the polynomial degree = 0 + 1.
rslt_default = kr.locpoly(x, y)
kr.plot(x, y, rslt_default, "motorcycle_default_fit.png")
# We can improve on the default specification by
# choosing a higher order polynomial
rslt_user = kr.locpoly(x, y, degree=3)
kr.plot(x, y, rslt_user, "motorcycle_user_fit.png")
References
Fan, J. and Gijbels, I. (1996). Local Polynomial Modelling and Its Applications. Monographs on Statistics and Applied Probability, 66. Chapman & Hall.
Wand, M.P. & Jones, M.C. (1995). Kernel Smoothing. Monographs on Statistics and Applied Probability, 60. Chapman & Hall.
Wand, M.P. and Ripley, B. D. (2015). KernSmooth: Functions for Kernel Smoothing for Wand and Jones (1995). R package version 2.23-18.
* The image is taken from futurist illustrator Arthur Radebaugh's (1906–1974)
Sunday comic strip Closer Than We Think!, which was published by the Chicago Tribune - New York News Syndicate from 1958 to 1963.
Metadata
Release files for kernreg 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kernreg-0.0.9.tar.gz | 15.9 kB | Without provenance | Details for kernreg-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kernreg-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for kernreg-0.0.9-py3-none-any.whl |
Total release size: 32.2 kB
Release files / kernreg-0.0.9.tar.gz
| Download URL | kernreg-0.0.9.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d4cd873a81c025c5f2b9a77f3ee45381600b6a6b4a0ce7bae39a924f6688bfa6
|
|
BLAKE2b-256 checksum How to use checksums |
e2c90a5bdd9b1fd691869706504a1f7f223018508caafbb21c1aa1bb5b27001a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.7 Linux/5.4.0-1039-azure
|
Release files / kernreg-0.0.9-py3-none-any.whl
| Download URL | kernreg-0.0.9-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1904593cd44d70b38f54b2eb7110ae8493f894bba75640dbdfffbd105991713
|
|
BLAKE2b-256 checksum How to use checksums |
6cb416178153e04f114edb564d1ef266fe7931f57c7632bf016d2133c0e074cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.7 Linux/5.4.0-1039-azure
|
Security for kernreg 0.0.9
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.