crs-package

Nonparametric Regression Splines with Continuous and Categorical Predictors

Nonparametric Regression Splines with Continuous and Categorical Predictors

This package provides a method for nonparametric regression that combines the (global) approximation power of regression splines for continuous predictors (‘x’ ) with the (local) power of kernel methods for categorical predictors (‘z’ ). The user also has the option of instead using indicator bases for the categorical predictors. When the predictors contain both continuous and categorical (discrete) data types, both approaches offer more efficient estimation than the traditional sample-splitting (i.e. frequency ) approach where the data is first broken into subsets governed by the categorical z.

To cite the crs package type: ‘citation("crs")’

(without the single quotes).

For a listing of all routines in the crs package type: ‘library(help="crs")’ .

For a listing of all demos in the crs package type: ‘demo(package="crs")’ .

For a ‘vignette’ that presents an overview of the crs package type: ‘vignette("crs")’ . package

Details

For the continuous predictors the regression spline model employs the B-spline basis matrix using the B-spline routines in the GNU Scientific Library (https://www.gnu.org/software/gsl/).

The tensor.prod.model.matrix function is used to construct multivariate tensor spline bases when basis="tensor"

and uses additive B-splines otherwise (i.e. when basis="additive").

For the discrete predictors the product kernel function is of the Li-Racine type (see Li and Racine (2007) for details) which is formed by constructing products of one of the following univariate kernels:

  • (zz is discrete/nominal): c("l(z[i],z,lambda)=\nl(z[i],z,lambda) =\n", "1 1") if z[i]=zz[i] = z, and lambdalambda if z[i]!=zz[i] != z. Note that lambdalambda must lie between 00 and 11.
  • (zz is discrete/ordinal): l(z[i],z,lambda)=1l(z[i],z,lambda) = 1 if z[i]z=0|z[i] - z| = 0, and lambdazizlambda^|z_i-z| if z[i]z>=1|z[i] - z|>=1. Note that lambdalambda must lie between 00 and 11.

Alternatively, for the ordinal/nominal predictors the regression spline model will use indicator basis functions.

Author(s)

Jeffrey S. Racine racinej@mcmaster.ca and Zhenghua Nie niez@mcmaster.ca

Maintainer: Jeffrey S. Racine racinej@mcmaster.ca

I would like to gratefully acknowledge support from the Natural Sciences and Engineering Research Council of Canada (https://www.nserc-crsng.gc.ca), the Social Sciences and Humanities Research Council of Canada (https://www.sshrc-crsh.gc.ca), and the Shared Hierarchical Academic Research Computing Network (https://www.sharcnet.ca).

References

Li, Q. and J.S. Racine (2007), Nonparametric Econometrics: Theory and Practice, Princeton University Press.

Ma, S. and J.S. Racine and L. Yang (2015), Spline Regression in the Presence of Categorical Predictors, Journal of Applied Econometrics, Volume 30, 705-717.

Ma, S. and J.S. Racine (2013), Additive Regression Splines with Irrelevant Categorical and ContinuousRegressors,

Statistica Sinica, Volume 23, 515-541.

  • Maintainer: Jeffrey S. Racine
  • License: GPL (>= 3)
  • Last published: 2024-09-29