This function fits a partial least squares (PLS) or sparse partial least squares (sPLS) regression model to predict \(\hat{Y}\) using the predictor matrix \(X\). The fitted values \(\hat{Y}\) are returned.

pls.recovery(Y, X, ncomp, keepX = rep(ncol(X)))

Arguments

Y

A numeric vector representing the response variable.

X

A numeric matrix or data frame representing the predictor variables.

ncomp

An integer specifying the number of components to use in the PLS regression model.

keepX

A numeric vector specifying the number of variables to keep in each dimension. By default, all variables are used.

Value

A numeric vector \(\hat{Y}\) containing the predicted values from the PLS regression model.

Details

This function performs PLS regression using the mixOmics package. It allows for both standard PLS and sparse PLS, where keepX controls the number of variables retained in each dimension. The function returns the predicted values \(\hat{Y}\) for the response variable \(Y\) using all the components specified by ncomp.

See also

Examples

X <- matrix(rnorm(100), nrow = 10, ncol = 10)
Y <- rnorm(10)
Y.hat <- pls.recovery(Y, X, ncomp = 2, keepX = rep(5, 2))