# penalized.pls: Penalized Partial Least Squares In ppls: Penalized Partial Least Squares

## Description

computes the regression coefficients for Penalized Partial Least Squares.

## Usage

 `1` ```penalized.pls(X, y, P, ncomp, kernel, scale ,blocks,select) ```

## Arguments

 `X` matrix of input data `y` vector of response data `P` penalty matrix. Default value is P=NULL, i.e. no penalization is used `ncomp` number of components, default value is the rank of the centered matrix `X`, that is min(ncol(X),nrow(X)-1) `kernel` logical value. If kernel=TRUE, penalized PLS is computed based on the kernel algorithm. Default value is kernel=FALSE `scale` logical value. If scale=TRUE, the X variables are standardized to have unit variance. Default value is FALSE `blocks` vector of length `ncol(X)` that encodes a block structure of the data. Default value is `1:ncol(X)`. See below for more details. `select` logical variable. If `logical=TRUE`, block-wise variable selection is applied. Default value is `FALSE`. See below for more details.

## Details

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. In addition, it is possible to select blocks of variables in each iteration step of penalized PLS. The block structure is encoded in the vector `blocks` of length `ncol(X)` that has the form 1,..,1,2,..,2,3,...,3,... . If `select=TRUE`, the algorithm select the weight vector with maximal penalized covariance under the constraint that only a single block in the weight vector is non-zero. This strategy is used for the combination of penalized PLS and B-splines transformations.

## Value

 `intercept` vector of length `ncomp`. The ith entry corresponds to the intercept for penalized PLS with i components `coefficients` matrix of dimension ncol(X) x `ncomp`. The ith column corresponds to the regressions coefficients for penalized PLS with i components

Nicole Kraemer

## References

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

`new.penalized.pls`, `penalized.pls.cv`, `ppls.splines.cv`, `Penalty.matrix`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20``` ```## 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]) ```

### Example output ```Loading required package: splines