This function is called internally by pls.regression and is not intended
to be used directly. Use pls.regression(..., calc.method = "NIPALS") instead.
Performs Partial Least Squares (PLS) regression using the NIPALS (Nonlinear Iterative Partial Least Squares) algorithm. This method estimates the latent components (scores, loadings, weights) by iteratively updating the X and Y score directions until convergence. It is suitable for cases where the number of predictors is large or predictors are highly collinear.
NIPALS.pls(x, y, n.components = NULL)A list with the following elements:
Character string indicating the model type ("PLS Regression").
Matrix of X scores (n × H).
Matrix of Y scores (n × H).
Matrix of X weights (p × H).
Matrix of normalized Y weights (q × H).
Matrix of X loadings (p × H).
Matrix of Y loadings (q × H).
Vector of regression scalars (length H), one for each component.
Matrix of regression coefficients in original data scale (p × q).
Vector of intercepts (length q). Always zero here due to centering.
Percent of total X variance explained by each component.
Percent of total Y variance explained by each component.
Cumulative X variance explained.
Cumulative Y variance explained.
A numeric matrix or data frame of predictors (X). Should have dimensions n × p.
A numeric matrix or data frame of response variables (Y). Should have dimensions n × q.
Integer specifying the number of PLS components to extract. If NULL, it defaults to qr(x)$rank.
The algorithm standardizes both x and y using z-score normalization. It then performs the following for each
of the n.components latent variables:
Initializes a random response score vector \(u\).
Iteratively:
Updates the X weight vector \(w = E^\top u\), normalized.
Computes the X score \(t = E w\), normalized.
Updates the Y loading \(q = F^\top t\), normalized.
Updates the response score \(u = F q\).
Repeats until \(t\) converges below a tolerance threshold.
Computes scalar regression coefficient \(b = t^\top u\).
Deflates residual matrices \(E\) and \(F\) to remove current component contribution.
After component extraction, the final regression coefficient matrix \(B_{original}\) is computed and rescaled to the original data units. Explained variance is also computed component-wise and cumulatively.
Wold, H., & Lyttkens, E. (1969). Nonlinear iterative partial least squares (NIPALS) estimation procedures. Bulletin of the International Statistical Institute, 43, 29–51.
if (FALSE) {
X <- matrix(rnorm(100 * 10), 100, 10)
Y <- matrix(rnorm(100 * 2), 100, 2)
model <- pls.regression(X, Y, n.components = 3, calc.method = "NIPALS")
model$coefficients
}
Run the code above in your browser using DataLab