This function computes the optimal model parameter using cross-validation.
Usage
pls.cv(
X,
y,
k = 10,
groups = NULL,
m = ncol(X),
use.kernel = FALSE,
compute.covariance = FALSE,
method.cor = "pearson"
)Arguments
- X
matrix of predictor observations.
- y
vector of response observations. The length of
yis the same as the number of rows ofX.- k
number of cross-validation splits. Default is 10.
- groups
an optional vector with the same length as
y. It encodes a partitioning of the data into distinct subgroups. Ifgroupsis provided,k=10is ignored and instead, cross-validation is performed based on the partioning. Default isNULL.- m
maximal number of Partial Least Squares components. Default is
m=ncol(X).- use.kernel
Use kernel representation? Default is
use.kernel=FALSE.- compute.covariance
If
TRUE, the function computes the covariance for the cv-optimal regression coefficients.- method.cor
How should the correlation to the response be computed? Default is ”pearson”.
Value
- cv.error.matrix
matrix of cross-validated errors based on mean squared error. A row corresponds to one cross-validation split.
- cv.error
vector of cross-validated errors based on mean squared error
- m.opt
optimal number of components based on mean squared error
- intercept
intercept of the optimal model, based on mean squared error
- coefficients
vector of regression coefficients of the optimal model, based on mean squared error
- cor.error.matrix
matrix of cross-validated errors based on correlation. A row corresponds to one cross-validation split.
- cor.error
vector of cross-validated errors based on correlation
- m.opt.cor
optimal number of components based on correlation
- intercept.cor
intercept of the optimal model, based on correlation
- coefficients.cor
vector of regression coefficients of the optimal model, based on mean squared error
- covariance
If
TRUEanduse.kernel=FALSE, the covariance of the cv-optimal regression coefficients (based on mean squared error) is returned.
Details
The data are centered and scaled to unit variance prior to the PLS
algorithm. It is possible to estimate the covariance matrix of the
cv-optimal regression coefficients (compute.covariance=TRUE).
Currently, this is only implemented if use.kernel=FALSE.
References
Kraemer, N., Sugiyama M. (2011). "The Degrees of Freedom of Partial Least Squares Regression". Journal of the American Statistical Association 106 (494) https://www.tandfonline.com/doi/abs/10.1198/jasa.2011.tm10107
Kraemer, N., Braun, M.L. (2007) "Kernelizing PLS, Degrees of Freedom, and Efficient Model Selection", Proceedings of the 24th International Conference on Machine Learning, Omni Press, 441 - 448
