X2s {ppls} | R Documentation |
This function transforms each column of a matrix using a set of B-spline functions.
X2s(X, Xtest = NULL, deg = 3, nknot = NULL,reduce.knots=FALSE)
X |
data matrix |
Xtest |
optional matrix of test data |
deg |
degree of the splines. Default value is 3 |
nknot |
vector of length ncol(X) . The jth entry
determines the number of knots to be used for the jth column
of X . Default value is rep(20,ncol(X)) . |
reduce.knots |
Logical variable. If TRUE , the function
assures that there the transformed data does not contain a constant
column. See below for more details. Default value is FALSE . |
Each column of the matrix X
represents one variable. For
each variable, we consider the set of B-splines functions
phi_1,...,phi_K that are determined by the degree deg
of the splines and the number nknot
of knots. The knots are
equidistantly based on the range of the variable. The data and – if
available – the test data is the transformed nonlinearly using the
B-splines function.
For a large amount of knots, it is possible that some columns of the
transformed matrix Z
only contain zeroes. If this is the case for
one variable and if reduce.knots=TRUE
, the amount of knots is reduced until this phenomenon does
not occur anymore. Note that the
penalized PLS algorithm runs correctly for constant columns in
Z
, unless you scale the
columns of the data.
Z |
matrix of transformed data |
Ztest |
matrix of test data, if provided. Otherwise, the transformed training data is returned. |
sizeZ |
vector of length ncol(X). Each component contains the number of basis functions for each column of X. |
Depending on the degrees of the splines - there
must be minimum number of knots. If nknot
contains too few knots,
the function automatically increases the number.
Nicole Kr"amer
C. de Boor (1978) A Practical Guide to Splines, Springer.
N. Kr"amer, A.-L. Boulsteix, and G. Tutz (2008). Penalized Partial Least Squares with Applications to B-Spline Transformations and Functional Data. Chemometrics and Intelligent Laboratory Systems, 94, 60 - 69.
X<-matrix(rnorm(100),ncol=5) Xtest<-matrix(rnorm(300),ncol=5) dummy<-X2s(X,Xtest)