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:
\(l(z_i,z,\lambda) = 1 \) if \(z_i=z\), and \(\lambda\) if \(z_i \neq z\). Note that \(\lambda\) must lie between \(0\) and \(1\).
\(l(z_i,z,\lambda) = 1\) if \(|z_i-z|=0\), and \(\lambda^{|z_i-z|}\) if \(|z_i - z|\ge1\). Note that \(\lambda\) must lie between \(0\) and \(1\).
Alternatively, for the ordinal/nominal predictors the regression spline model will use indicator basis functions.
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 Continuous Regressors,” Statistica Sinica, Volume 23, 515-541.