# Cross-validation for Penalized PLS

### Description

Computes the cross-validated error of penalized PLS for different values of lambda and components, and returns the parameter values and coefficients for the optimal model.

### Usage

1 | ```
penalized.pls.cv(X, y, P, lambda, ncomp, k, kernel,scale)
``` |

### Arguments

`X` |
matrix of input data |

`y` |
vector of responses |

`P` |
Penalty matrix. For the default value |

`lambda` |
vector of candidate parameters lambda for the amount of penalization. Default value is 1 |

`ncomp` |
Number of penalized PLS components to be computed. Default value is min(nrow(X)-1,ncol(X)) |

`k` |
the number of splits in |

`kernel` |
Logical value. If |

`scale` |
logical value. If scale=TRUE, the X variables are standardized to have unit variance. Default value is FALSE |

### Value

`error.cv` |
matrix of cross-validated errors. The rows correspond to the values of lambda, the columns correspond to the number of components. |

`lambda` |
vector of candidate parameters lambda for the amount of penalization |

`lambda.opt ` |
Optimal value of lambda |

`index.lambda` |
Index for the optimal value of lambda |

`ncomp.opt` |
Optimal number of penalized PLS components |

`min.ppls` |
Cross-validated error for the optimal penalized PLS solution |

`intercept` |
Intercept for the optimal model, computed on the whole data set |

`coefficients` |
Regression coefficients for the optimal model, computed on the whole data set |

`coefficients.jackknife` |
array of regression coefficients for each cross-validation run and each parameter setting. The dimension is |

### Author(s)

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

### See Also

`ppls.splines.cv`

,`penalized.pls`

,`new.penalized.pls`

,`jack.ppls`

### Examples

1 2 3 4 5 6 | ```
# the penalty term in this example does not make much
# sense
X<-matrix(rnorm(20*100),ncol=20)
y<-rnorm(rnorm(100))
P<-Penalty.matrix(m=20)
pen.pls<-penalized.pls.cv(X,y,lambda=c(0,1,10),P=P,ncomp=10,kernel=FALSE)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.