Computes orthogonal socres partial least squares (opls) projection with the NIPALS algorithm. It allows multiple response variables. Although the main use of the function is for projection, it also retrieves regression coefficients. NOTE: For internal use only!
opls_for_projection(X, Y, ncomp, scale,
maxiter, tol,
pcSelmethod = "var",
pcSelvalue = 0.01,
algorithm = "pls",
xls_min_w = 3,
xls_max_w = 15)
a list containing the following elements:
coefficients
the matrix of regression coefficients.
bo
a matrix of one row containing the intercepts for
each component.
scores
the matrix of scores.
X_loadings
the matrix of X loadings.
Y_loadings
the matrix of Y loadings.
projection_mat
the projection matrix.
Y
the Y
input.
variance
a list
conating two objects: x_var
and y_var
.
These objects contain information on the explained variance for the X
and Y
matrices respectively.
transf
a list
conating two objects: Xcenter
and Xscale
.
weights
the matrix of wheights.
a matrix of predictor variables.
a matrix of either a single or multiple response variables.
the number of pls components.
logical indicating whether X
must be scaled.
maximum number of iterations.
limit for convergence of the algorithm in the nipals algorithm.
if regression = TRUE
, the method for selecting the
number of components.
Options are: 'manual'
, 'cumvar'
(for selecting the number of
principal components based on a given cumulative amount of explained
variance) and 'var'
(for selecting the number of principal components
based on a given amount of explained variance). Default is 'cumvar'
.
a numerical value that complements the selected method
(pcSelmethod
).
If 'cumvar'
is chosen (default), pcSelvalue
must be a value
(larger than 0 and below 1) indicating the maximum amount of cumulative
variance that the retained components should explain. Default is 0.99.
If 'var'
is chosen, pcSelvalue
must be a value (larger than 0
and below 1) indicating that components that explain (individually)
a variance lower than this threshold must be excluded. If 'manual'
is chosen, pcSelvalue
has no effect and the number of components
retrieved are the one specified in ncomp
.
(for weights computation) a character string indicating
what method to use. Options are:
'pls'
for pls (using covariance between X and Y),
'mpls'
for modified pls (using correlation between X and Y) or
'xls'
for extended pls (as implemented in BUCHI NIRWise PLUS software).
(for weights computation) an integer indicating the minimum window size for the "xls"
method. Only used if algorithm = 'xls'
. Default is 3 (as in BUCHI NIRWise PLUS software).
(for weights computation) an integer indicating the maximum window size for the "xls"
method. Only used if algorithm = 'xls'
. Default is 15 (as in BUCHI NIRWise PLUS software).
Leonardo Ramirez-Lopez