Learn R Programming

plsRglm (version 1.7.1)

predict.plsRmultiModel: Predict method for experimental plsRmulti models

Description

Prediction method for "plsRmultiModel" objects.

Usage

# S3 method for plsRmultiModel
predict(
  object,
  newdata,
  comps = object$computed_nt,
  type = c("response", "scores"),
  verbose = TRUE,
  ...
)

Value

If type = "response", a matrix of predicted responses. If type = "scores", a matrix of latent score coordinates.

Arguments

object

An object of class "plsRmultiModel".

newdata

Optional predictor matrix or data frame. For formula-fitted models, a data frame with the predictor variables used at fit time.

comps

Number of extracted components to use.

type

Either "response" or "scores".

verbose

Should informational messages be displayed?

...

Not used.

See Also

plsRmulti

Examples

Run this code
set.seed(123)
X <- matrix(rnorm(40 * 3), ncol = 3)
Y <- cbind(
  y1 = X[, 1] + rnorm(40, sd = 0.1),
  y2 = X[, 2] - X[, 3] + rnorm(40, sd = 0.1)
)
fit <- plsRmulti(Y, X, nt = 2, verbose = FALSE)

predict(fit, type = "response")
predict(fit, type = "scores")

Run the code above in your browser using DataLab