powered by
Naive sparsity control by coefficient thresholding
pls_threshold(object, threshold)
A modified copy of object with thresholded coefficients.
object
A fitted PLS model.
Values below this absolute magnitude are set to zero.
set.seed(123) X <- matrix(rnorm(40), nrow = 10) y <- X[, 1] - 0.5 * X[, 2] + rnorm(10, sd = 0.1) fit <- pls_fit(X, y, ncomp = 2) pls_threshold(fit, threshold = 0.05)
Run the code above in your browser using DataLab