R Packages

np and npRmpi

The np package implements nonparametric and semiparametric kernel-based methods in R, including kernel regression, density estimation, conditional density estimation, distribution methods, quantiles, and inferential procedures for mixed data. It handles continuous, unordered factor, and ordered factor data in a unified smoothing framework.

The current CRAN release of np is 0.70-1 (published 2026-05-02). The current CRAN release of npRmpi is 0.70-1 (published 2026-05-01). npRmpi is the MPI-aware companion to np for larger jobs and explicit message-passing workflows.

Package Pointers

The original package article is Hayfield and Racine (2008). See also the October 2007 R News article PDF, the current entropy vignette on CRAN, and the accompanying R code.

Reviews appeared in the Journal of Applied Econometrics for np and npRmpi.

NoteDevelopment-branch plotting note

The GitHub/development branches of np and npRmpi already include a plotting-interface redesign targeted at 0.70-2, even though the current CRAN releases remain 0.70-1.

Development-branch users should expect newer public plotting controls such as errors, bootstrap, band, data_rug, data_overlay, and other snake_case argument names. The Gallery of Code reflects that current development-branch plotting surface.

Method Families

Family Typical Functions Notes
Kernel regression npreg, npregbw Conditional mean estimation and prediction for mixed data.
Unconditional density/distribution npudens, npudensbw, npudist, npudistbw Density and distribution estimation with continuous and discrete variables.
Conditional density/distribution npcdens, npcdensbw, npcdist, npcdistbw Conditional PDF/CDF workflows, including quantile-related use cases.
Quantile regression npqreg Nonparametric conditional quantiles derived from conditional distribution machinery.
Semiparametric models npplreg, npindex, npscoef Partially linear, single-index, and smooth-coefficient model families.
Specification and inference package tests and vignettes Entropy, significance, and related inferential procedures.

npRmpi is the parallel sibling for larger jobs and MPI-aware workflows. It should be viewed as a companion implementation for computationally intensive tasks, not as a separate methodology.

crs

The crs package implements multivariate regression splines, including quantile regression splines and support for continuous and categorical predictors. The current CRAN release is crs 0.15-42 (published 2026-05-01).

Package Pointers

The package article is Nie and Racine (2012), published in The R Journal article page and PDF.

Method Families

Family Typical Use Notes
Categorical regression splines Mixed continuous/categorical predictors Core crs workflow.
Quantile regression splines Conditional quantile surfaces Available through quantile-oriented spline routes.
Model selection and smoothing Data-driven spline specification Complements the kernel-smoothing philosophy in np.

Legacy Package Materials

ma

The ma package implements model averaging using a variety of multivariate bases and averaging criteria.

hr

The hr package implements the Hansen-Racine bootstrap model-average unit-root test.

Stata Implementations

As of Stata 15, Stata users have access to mixed-datatype kernel regression methods through npregress. It is the Stata counterpart to npreg in the R package np, with different defaults and options.

Back to top

References

Hayfield, Tristen, and Jeffrey S. Racine. 2008. “Nonparametric Econometrics: The np Package.” Journal of Statistical Software 27 (5): 1–32. https://doi.org/10.18637/jss.v027.i05.
Nie, Zhenghua, and Jeffrey S. Racine. 2012. “The crs Package: Nonparametric Regression Splines for Continuous and Categorical Predictors.” R J. 4: 48. https://api.semanticscholar.org/CorpusID:10908672.