penalized.pls {ppls} | R Documentation |
This function computes the regression coefficients using the Penalized Partial Least Squares methodology (see Kraemer, Boulesteix and Tutz, 2007).
penalized.pls(X, y, P = NULL, ncomp = NULL, kernel = FALSE, scale = FALSE)
X |
A n x p matrix of input data. |
y |
A numeric n-vector of responses. |
P |
The penalty matrix. Default value is P=NULL, i.e. no penalization is used. |
ncomp |
The number of penalized PLS components. Default value is min(ncol(p),nrow(X)-1) . |
kernel |
If kernel=TRUE , penalized PLS is computed
based on the kernel algorithm. Default value is kernel=FALSE . |
scale |
If scale=TRUE , the X variables are
standardized to have unit variance. Default value is scale=FALSE . |
The regression coefficients can be computed in two different
but equivalent ways. The first one is the extension of the classical
NIPALS algorithm for PLS (which corresponds to kernel=FALSE
),
and the second one is based on a kernel representation. The latter
method is in general faster if the number of observations is small
compared to the number of variables.
Note that P=NULL
corresponds to Partial Least Squares without penalization.
intercept |
A vector of length ncomp . The ith entry corresponds to
the intercept for penalized PLS with i components. |
coefficients |
A ncol(X) x ncomp matrix. The ith
column corresponds to the regressions coefficients for penalized
PLS with i components. |
Nicole Kraemer
N. Kraemer, A.-L. Boulesteix, G. Tutz (2007) "Penalized Partial Least Squares with Applications to B-Splines Transformations and Functional Data", preprint
available at http://ml.cs.tu-berlin.de/~nkraemer/publications.html
new.penalized.pls
,
penalized.pls.cv
, ppls.splines.cv
,
Penalty.matrix
## example from the paper ## # load BOD data data(BOD) X<-BOD[,1] y<-BOD[,2] Xtest=seq(min(X),max(X),length=200) # generate test data for plot dummy<-X2s(X,Xtest,deg=3,nknot=20) # transformation of the data Z<-dummy$Z # transformed X data Ztest<-dummy$Ztest # transformed Xtest data size<-dummy$sizeZ # size of the transformed data P<-Penalty.matrix(size,order=2) # Penalty matrix lambda<-200 # amount of penalization number.comp<-3 # number of components ppls<-penalized.pls(Z,y,P=lambda*P,ncomp=number.comp) # fit new.ppls<-new.penalized.pls(ppls,Ztest)$ypred # prediction for test data ## plot fitted values for 2 components plot(X,y,lwd=3,xlim=range(Xtest)) lines(Xtest,new.ppls[,2])