X2s: Nolinear Transformation via B-splines

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

This function transforms each column of a matrix using a set of B-spline functions.

Usage

1
X2s(X, Xtest = NULL, deg = 3, nknot = NULL,reduce.knots=FALSE)

Arguments

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.

Details

Each column of the matrix X represents one variable. For each variable, we consider the set of B-splines functions φ_1,...,φ_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.

Value

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.

Note

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.

Author(s)

Nicole Kraemer

References

C. de Boor (1978) A Practical Guide to Splines, Springer.

N. Kraemer, 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. http://dx.doi.org/10.1016/j.chemolab.2008.06.009

See Also

ppls.splines.cv,graphic.ppls.splines

Examples

1
2
3
X<-matrix(rnorm(100),ncol=5)
Xtest<-matrix(rnorm(300),ncol=5)
dummy<-X2s(X,Xtest)

Example output

Loading required package: splines
Loading required package: MASS

ppls documentation built on May 1, 2019, 10:53 p.m.