o2m {OmicsPLS} | R Documentation |
Perform O2PLS data integration with two-way orthogonal corrections
Description
NOTE THAT THIS FUNCTION DOES NOT CENTER NOR SCALE THE MATRICES! Any normalization you will have to do yourself. It is best practice to at least center the variables though.
Usage
o2m(
X,
Y,
n,
nx,
ny,
stripped = FALSE,
p_thresh = 3000,
q_thresh = p_thresh,
tol = 1e-10,
max_iterations = 1000,
sparse = F,
groupx = NULL,
groupy = NULL,
keepx = NULL,
keepy = NULL,
max_iterations_sparsity = 1000
)
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)? |
p_thresh |
Integer. If |
q_thresh |
Integer. If |
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. |
sparse |
Boolean. Default value is |
groupx |
Vector. Used when |
groupy |
Vector. Used when |
keepx |
Vector. Used when |
keepy |
Vector. Used when |
max_iterations_sparsity |
Integer. Used when |
Details
If both nx
and ny
are zero, o2m
is equivalent to PLS2 with orthonormal loadings.
This is a ‘slower’ (in terms of memory) implementation of O2PLS, and is using svd
, use stripped=T
for a stripped version with less output.
If either ncol(X) > p_thresh
or ncol(Y) > q_thresh
, the NIPALS method is used which does not store the entire covariance matrix.
The squared error between iterands in the NIPALS approach can be adjusted with tol
.
The maximum number of iterations in the NIPALS approach is tuned by max_iterations
.
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 |
W_gr |
Joint loadings of |
C_gr |
Joint loadings of |
See Also
summary.o2m
, plot.o2m
, crossval_o2m_adjR2
, crossval_sparsity
Examples
test_X <- scale(matrix(rnorm(100*10),100,10))
test_Y <- scale(matrix(rnorm(100*11),100,11))
# --------- Default run ------------
o2m(test_X, test_Y, 3, 2, 1)
# ---------- Stripped version -------------
o2m(test_X, test_Y, 3, 2, 1, stripped = TRUE)
# ---------- High dimensional version ----------
o2m(test_X, test_Y, 3, 2, 1, p_thresh = 1)
# ------ High D and stripped version ---------
o2m(test_X, test_Y, 3, 2, 1, stripped = TRUE, p_thresh = 1)
# ------ Now with more iterations --------
o2m(test_X, test_Y, 3, 2, 1, stripped = TRUE, p_thresh = 1, max_iterations = 1e6)
# ----------------------------------