predict.enspls.fit {enpls}R Documentation

Make Predictions from a Fitted Sparse Ensemble Partial Least Squares Model

Description

Make predictions on new data by fitted enspls.fit object.

Usage

## S3 method for class 'enspls.fit'
predict(object, newx, method = c("mean", "median"),
  ...)

Arguments

object

An object of class enspls.fit.

newx

New data to predict with.

method

Use "mean" or "median" to create the final prediction.

...

Additional parameters for predict.

Value

A numeric vector containing the predicted values.

Author(s)

Nan Xiao <https://nanx.me>

See Also

See enspls.fit for fitting ensemble sparse partial least squares regression models.

Examples

data("logd1k")
x <- logd1k$x
y <- logd1k$y

set.seed(42)
fit <- enspls.fit(x, y, reptimes = 5, maxcomp = 2)
y.pred <- predict(fit, newx = x)
plot(y, y.pred, xlim = range(y), ylim = range(y))
abline(a = 0L, b = 1L)
y.pred.med <- predict(fit, newx = x, method = "median")
plot(y, y.pred.med, xlim = range(y), ylim = range(y))
abline(a = 0L, b = 1L)

[Package enpls version 6.1 Index]