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")`

’.

For the continuous predictors the regression spline model employs the B-spline basis matrix using the B-spline routines in the GNU Scientific Library (http://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:

- (
*z*is discrete/nominal) -
*l(z[i],z,lambda) = 1*if*z[i] = z*, and*lambda*if*z[i] != z*. Note that*lambda*must lie between*0*and*1*. - (
*z*is discrete/ordinal) -
*l(z[i],z,lambda) = 1*if*|z[i] - z| = 0*, and*lambda^|z_i-z|*if*|z[i] - z|>=1*. Note that*lambda*must lie between*0*and*1*.

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

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 (http://www.nserc.ca), the Social Sciences and Humanities Research Council of Canada (http://www.sshrc.ca), and the Shared Hierarchical Academic Research Computing Network (http://www.sharcnet.ca).

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

Ma, S. and J.S. Racine and L. Yang (under revision), “Spline Regression in the Presence of Categorical Predictors,” Journal of Applied Econometrics.

Ma, S. and J.S. Racine (2013), “Additive Regression Splines with Irrelevant Categorical and Continuous Regressors,” Statistica Sinica, Volume 23, 515-541.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.