X2s {ppls} | R Documentation |
Nonlinear Transformation via B-Splines
Description
Transforms each column of a numeric matrix (or vector) into a new basis defined by B-spline functions.
Usage
X2s(X, Xtest = NULL, deg = 3, nknot = NULL, reduce.knots = FALSE)
Arguments
X |
Numeric matrix or vector of input data. |
Xtest |
Optional numeric matrix or vector of test data. Defaults to |
deg |
Degree of the B-splines (default is 3). |
nknot |
Vector specifying the number of knots per column. Default is |
reduce.knots |
Logical. Reduces knots to avoid constant columns if TRUE (default is FALSE). |
Value
A list containing:
- Z
Design matrix for training data (B-spline coefficients).
- Ztest
Design matrix for test data.
- sizeZ
Vector of number of basis functions for each column.
References
Kraemer, N., Boulesteix, A.-L., & Tutz, G. (2008). Penalized Partial Least Squares with Applications to B-Spline Transformations and Functional Data. Chemometrics and Intelligent Laboratory Systems, 94, 60-69. https://doi.org/10.1016/j.chemolab.2008.06.009
Examples
X <- matrix(rnorm(100), ncol = 5)
Xtest <- matrix(rnorm(300), ncol = 5)
result <- X2s(X, Xtest)