powered by
Component selection via information criteria
pls_select_components( object, X, Y, criteria = c("aic", "bic"), max_comp = NULL )
A list with the per-component table and the selected components.
A fitted PLS model.
Training design matrix.
Training response matrix or vector.
Character vector specifying which criteria to compute.
Maximum number of components to consider.
set.seed(123) X <- matrix(rnorm(60), nrow = 20) y <- X[, 1] - 0.5 * X[, 2] + rnorm(20, sd = 0.1) fit <- pls_fit(X, y, ncomp = 2, scores = "r") pls_select_components(fit, X, y)
Run the code above in your browser using DataLab