Learn R Programming

sharp (version 1.4.7)

PredictPLS: Partial Least Squares predictions

Description

Computes predicted values from a Partial Least Squares (PLS) model in regression mode applied on xdata. This function is using the algorithm implemented in predict.pls.

Usage

PredictPLS(xdata, model)

Value

An array of predicted values.

Arguments

xdata

matrix of predictors with observations as rows and variables as columns.

model

output of PLS.

See Also

PLS

Examples

Run this code
if (requireNamespace("mixOmics", quietly = TRUE)) {
  # Data simulation
  set.seed(1)
  simul <- SimulateRegression(n = 100, pk = c(5, 5, 5), family = "gaussian")
  x <- simul$xdata
  y <- simul$ydata

  # PLS
  mypls <- PLS(xdata = x, ydata = y, ncomp = 3)

  # Predicted values
  predicted <- PredictPLS(xdata = x, model = mypls)
}

Run the code above in your browser using DataLab