crs: A package for nonparametric spline estimation in R



Journal Title

Journal ISSN

Volume Title



crs is a library for R written by Jeffrey S. Racine (Maintainer) and Zhenghua Nie. This add-on package provides a collection of functions for spline-based nonparametric estimation of regression functions with both continuous and categorical regressors. Currently, the crs package integrates data-driven methods for selecting the spline degree, the number of knots and the necessary bandwidths for nonparametric conditional mean, IV and quantile regression. A function for multivariate density spline estimation with mixed data is also currently in the works. As a bonus, the authors have also provided the first simple R interface to the NOMAD (‘nonsmooth mesh adaptive direct search’) optimization solver which can be applied to solve other mixed integer optimization problems that future users might find useful in other settings. Although the crs package shares some of the same functionalities as its kernel-based counterpart—the np package by the same author—it currently lacks some of the features the np package provides, such as hypothesis testing and semiparametric estimation. However, what it lacks in breadth, crs makes up in speed. A Monte Carlo experiment in this review uncovers sizable speed gains compared to its np counterpart, with a marginal loss in terms of goodness of fit. Therefore, the package will be extremely useful for applied econometricians interested in employing nonparametric techniques using large amounts of data with a small number of discrete covariates.



Software, crs, Add-on package, Nonparametric spline estimation