pls.regression {snazzieR} | R Documentation |
Partial Least Squares (PLS) Regression Interface
Description
Performs Partial Least Squares (PLS) regression using either the NIPALS or SVD algorithm for component extraction.
This is the main user-facing function for computing PLS models. Internally, it delegates to either NIPALS.pls()
or SVD.pls()
.
Usage
pls.regression(x, y, n.components = NULL, calc.method = c("SVD", "NIPALS"))
Arguments
x |
A numeric matrix or data frame of predictor variables (X), with dimensions n × p. |
y |
A numeric matrix or data frame of response variables (Y), with dimensions n × q. |
n.components |
Integer specifying the number of latent components (H) to extract. If NULL, defaults to the rank of |
calc.method |
Character string indicating the algorithm to use. Must be either |
Details
This function provides a unified interface for Partial Least Squares regression. Based on the value of calc.method
,
it computes latent variables using either:
-
"SVD"
— A direct method using the singular value decomposition of the cross-covariance matrix (X^\top Y
). -
"NIPALS"
— An iterative method that alternately estimates predictor and response scores until convergence.
The outputs from both methods include scores, weights, loadings, regression coefficients, and explained variance.
Value
A list (from either SVD.pls()
or NIPALS.pls()
) containing:
- model.type
Character string ("PLS Regression").
- T, U
Score matrices for X and Y.
- W, C
Weight matrices for X and Y.
- P_loadings, Q_loadings
Loading matrices.
- B_vector
Component-wise regression weights.
- coefficients
Final regression coefficient matrix (rescaled).
- intercept
Intercept vector (typically zero due to centering).
- X_explained, Y_explained
Variance explained by each component.
- X_cum_explained, Y_cum_explained
Cumulative variance explained.
References
Abdi, H., & Williams, L. J. (2013). Partial least squares methods: Partial least squares correlation and partial least square regression. Methods in Molecular Biology (Clifton, N.J.), 930, 549–579. doi:10.1007/978-1-62703-059-5_23
de Jong, S. (1993). SIMPLS: An alternative approach to partial least squares regression. Chemometrics and Intelligent Laboratory Systems, 18(3), 251–263. doi:10.1016/0169-7439(93)85002-X
See Also
Examples
## Not run:
X <- matrix(rnorm(100 * 10), 100, 10)
Y <- matrix(rnorm(100 * 2), 100, 2)
# Using SVD (default)
model1 <- pls.regression(X, Y, n.components = 3)
# Using NIPALS
model2 <- pls.regression(X, Y, n.components = 3, calc.method = "NIPALS")
## End(Not run)