o2m2 {OmicsPLS} | R Documentation |
Perform O2-PLS with two-way orthogonal corrections
Description
NOTE THAT THIS FUNCTION DOES NOT CENTER NOR SCALES THE MATRICES! Any normalization you will have to do yourself. It is best practice to at least center the variables though.
Usage
o2m2(X, Y, n, nx, ny, stripped = TRUE, tol = 1e-10, max_iterations = 100)
Arguments
X |
Numeric matrix. Vectors will be coerced to matrix with |
Y |
Numeric matrix. Vectors will be coerced to matrix with |
n |
Integer. Number of joint PLS components. Must be positive. |
nx |
Integer. Number of orthogonal components in |
ny |
Integer. Number of orthogonal components in |
stripped |
Logical. Use the stripped version of o2m (usually when cross-validating)? |
tol |
Double. Threshold for which the NIPALS method is deemed converged. Must be positive. |
max_iterations |
Integer. Maximum number of iterations for the NIPALS method. |
Details
If both nx
and ny
are zero, o2m2
is equivalent to PLS2 with orthonormal loadings.
For cross-validation purposes, consider using stripped = TRUE
.
Note that in this function, a power-method based approach is used when the data dimensionality is larger than the sample size. E.g. for genomic data the covariance matrix might be too memory expensive.
Value
A list containing
Tt |
Joint |
W. |
Joint |
U |
Joint |
C. |
Joint |
E |
Residuals in |
Ff |
Residuals in |
T_Yosc |
Orthogonal |
P_Yosc. |
Orthogonal |
W_Yosc |
Orthogonal |
U_Xosc |
Orthogonal |
P_Xosc. |
Orthogonal |
C_Xosc |
Orthogonal |
B_U |
Regression coefficient in |
B_T. |
Regression coefficient in |
H_TU |
Residuals in |
H_UT |
Residuals in |
X_hat |
Prediction of |
Y_hat |
Prediction of |
R2X |
Variation (measured with |
R2Y |
Variation (measured with |
R2Xcorr |
Variation (measured with |
R2Ycorr |
Variation (measured with |
R2X_YO |
Variation (measured with |
R2Y_XO |
Variation (measured with |
R2Xhat |
Variation (measured with |
R2Yhat |
Variation (measured with |
See Also
Examples
# This takes a couple of seconds on an intel i5
system.time(
o2m2(matrix(rnorm(50*2000),50),matrix(rnorm(50*2000),50),1,0,0)
)
# This however takes 10 times as much...
# system.time(
# o2m(matrix(rnorm(50*2000),50),matrix(rnorm(50*2000),50),1,0,0,
# p_thresh = 1e4,q_thresh = 1e4) # makes sure power method is not used
# )