| rpls | R Documentation |
Implements the algorithm of Allen et al. (2013) for supervised
dimension-reduction with optional sparsity (\ell_1) or ridge
(\ell_2) penalties and the generalised extension that operates
in a user-supplied quadratic form Q.
rpls(
X,
Y,
K = 2,
lambda = 0.1,
penalty = c("l1", "ridge"),
Q = NULL,
nonneg = FALSE,
preproc_x = multivarious::pass(),
preproc_y = multivarious::pass(),
tol = 1e-06,
maxiter = 200,
verbose = FALSE,
...
)
X |
Numeric matrix |
Y |
Numeric matrix |
K |
Integer, number of latent factors to extract. Default |
lambda |
Scalar or length- |
penalty |
Either |
Q |
Optional positive-(semi)definite |
nonneg |
Logical, force non-negative loadings when
|
preproc_x, preproc_y |
Optional multivarious preprocessing
objects (see |
tol |
Relative tolerance for the inner iterations convergence check.
Default |
maxiter |
Maximum number of inner iterations per component. Default |
verbose |
Logical; print progress messages during component extraction.
Default |
... |
Further arguments (e.g., custom stopping criteria if implemented)
are stored in the returned object (they are not used by
|
Unlike genpls(), which handles separate row and column metrics (Mx,
Ax, My, Ay) with a Gram–Schmidt orthogonalisation step, rpls()
uses a single metric Q and the simpler penalised updates of Allen et al.
An object of class c("rpls","cross_projector","projector")
with at least the elements
p \times K matrix of X-loadings.
q \times K matrix of Y-loadings.
Number of components actually extracted (may be < K).
Penalty type used ("l1" or "ridge").
The lambda value(s) used.
The convergence tolerance used.
The maximum number of inner iterations used per component.
Logical flag for the non-negativity constraint on l1.
Logical; TRUE if a custom Q metric was supplied to
induce generalised RPLS, FALSE for standard (identity-metric)
RPLS. Note the field is named Q_used, not Q: the metric matrix
itself is not retained on the returned object.
The verbose flag used.
Pre-processing transforms used.
rpls objects store no row (X-)scores: the factors z_k are
computed internally during fitting to drive deflation and are then
discarded, so use multivarious::project() on X to obtain
scores for any rows of interest.
The object supports predict(), project(),
transfer(), coef() and other multivarious generics.
The routine follows Algorithm 1 of Allen et al. (2013, Stat.
Anal. Data Min., 6 : 302–314) — see the paper for details. Briefly, with
C = X^\top Y the cross-product of the (preprocessed) blocks, each
component maximises
\max_{u,v}\; v^\top Q C u - \lambda \, P(v)
with Q = I_p for standard RPLS. The alternating updates are:
u \leftarrow C^\top Q v / \|C^\top Q v\|_2, then a penalised
(possibly non-negative) regression for v, normalised in the
Q-norm.
Allen, G. I., Peterson, C., Vannucci, M., & Maletić-Savatić, M. (2013). Regularized Partial Least Squares with an Application to NMR Spectroscopy. Statistical Analysis and Data Mining, 6(4), 302-314. DOI:10.1002/sam.11169.
# Generate sample data
set.seed(123)
n <- 50
p <- 20
q <- 10
X <- matrix(rnorm(n * p), n, p)
Y <- X[, 1:5] %*% matrix(rnorm(5 * q), 5, q) + matrix(rnorm(n * q), n, q)
# Fit regularized PLS with L1 penalty
fit_l1 <- rpls(X, Y, K = 3, lambda = 0.1, penalty = "l1")
print(fit_l1)
# Fit regularized PLS with ridge penalty
fit_ridge <- rpls(X, Y, K = 3, lambda = 0.1, penalty = "ridge")
print(fit_ridge)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.