o2m2: Perform O2-PLS with two-way orthogonal corrections

Description Usage Arguments Details Value See Also Examples

View source: R/OmicsPLS_o2m.R

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

1
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 as.matrix (if this is possible)

Y

Numeric matrix. Vectors will be coerced to matrix with as.matrix (if this is possible)

n

Integer. Number of joint PLS components. Must be positive.

nx

Integer. Number of orthogonal components in X. Negative values are interpreted as 0

ny

Integer. Number of orthogonal components in Y. Negative values are interpreted as 0

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 X scores

W.

Joint X loadings

U

Joint Y scores

C.

Joint Y loadings

E

Residuals in X

Ff

Residuals in Y

T_Yosc

Orthogonal X scores

P_Yosc.

Orthogonal X loadings

W_Yosc

Orthogonal X weights

U_Xosc

Orthogonal Y scores

P_Xosc.

Orthogonal Y loadings

C_Xosc

Orthogonal Y weights

B_U

Regression coefficient in Tt ~ U

B_T.

Regression coefficient in U ~ Tt

H_TU

Residuals in Tt in Tt ~ U

H_UT

Residuals in U in U ~ Tt

X_hat

Prediction of X with Y

Y_hat

Prediction of Y with X

R2X

Variation (measured with ssq) of the modeled part in X (defined by joint + orthogonal variation) as proportion of variation in X

R2Y

Variation (measured with ssq) of the modeled part in Y (defined by joint + orthogonal variation) as proportion of variation in Y

R2Xcorr

Variation (measured with ssq) of the joint part in X as proportion of variation in X

R2Ycorr

Variation (measured with ssq) of the joint part in Y as proportion of variation in Y

R2X_YO

Variation (measured with ssq) of the orthogonal part in X as proportion of variation in X

R2Y_XO

Variation (measured with ssq) of the orthogonal part in Y as proportion of variation in Y

R2Xhat

Variation (measured with ssq) of the predicted X as proportion of variation in X

R2Yhat

Variation (measured with ssq) of the predicted Y as proportion of variation in Y

See Also

o2m

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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
# )

OmicsPLS documentation built on May 19, 2021, 5:08 p.m.