Mathematica 9 is now available

Wolfram Library Archive

Courseware Demos MathSource Technical Notes
All Collections Articles Books Conference Proceedings
Title Downloads

Nonparametric Kernel Density Estimation and Local Regressions with Mathematica

Bernard Gress
Organization: Fannie Mae

2004 Wolfram Technology Conference
Conference location

Champaign IL

NonParametrix.m is a Mathematica package that provides many of the basic (as well as a few advanced) functions often used in nonparametric econometrics and statistics, as described in, for example, Pagan and Ullah (1999), Silverman (1986), or Härdle (1989).


Provides nonparametric density estimation of multivariate data with user-defined kernels. Includes very fast routines for standard kernels such as the normal, Epanechinikov, and the uniform.


Uses optimized, high-speed routines to fit an arbitrary order, nonparametric local polynomial regression estimation on multivariate data of any dimension, with pre-defined or user-defined kernels. Also estimates slopes, regression residuals, confidence intervals, and can output an Interpolating function of the Fits to use elsewhere. Also includes high-speed local polynomial, generalized least squares (GLS) routines.


Finds the optimal window width ('h') for multivariate nonparametric regressions. Includes mean square error, root mean square error, median absolute error, mean absolute percentage error, and median prediction error loss functions. Allows the user to select many of the parameters of the cross-validation routine. Also allows for the use of arbitrary kernels, albeit at much slower speeds.

Other Assorted Functions

SilvermanH calculates the well-known asymptotic kernel window width for data of arbitrary dimensions. FastNPDensity provides very quick and dirty univariate density estimation when the user is mostly interested in quick visualization of data. MultipleKDensityPlot provides quick and dirty estimation of multiple densities, color coded for easy data visualization.

NonParametrix.m is available at

*Business and Economics
*Mathematics > Probability and Statistics

nonparametric econometrics, statistics, Kernel Density Estimation
Downloads Download Wolfram CDF Player

Nonparametrix.m Intro - Bernard Gress - 2004.nb (7.6 MB) - Mathematica Notebook