adjR2: Gridwise adjusted R2 for O2PLS

View source: R/OmicsPLS.R

adjR2R Documentation

Gridwise adjusted R2 for O2PLS

Description

For (a grid of) values for a, nx and ny, loocv calculates the R2 of the joint part. Parallel computing is supported on Windows with package parallel.

Usage

adjR2(
  X,
  Y,
  a = 1:2,
  a2 = 1,
  b2 = 1,
  func = o2m,
  parall = F,
  cl = NULL,
  stripped = TRUE,
  p_thresh = 3000,
  q_thresh = p_thresh,
  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)

a

Vector of integers. Contains the numbers of joint components.

a2

Vector of integers. Contains the numbers of orthogonal components in X.

b2

Vector of integers. Contains the numbers of orthogonal components in Y.

func

Function to fit the O2PLS model with. Only o2m and o2m_stripped are supported.

parall

Integer. Should a parallel cluster be set up using package parallel (Windows)? Best is to leave it to FALSE.

cl

Object of class 'cluster'. If parall is TRUE and cl is not NULL, calculations are parallelized over workers in cl.

stripped

Logical. Use the stripped version of o2m (usually when cross-validating)?

p_thresh

Integer. If X has more than p_thresh columns, a power method optimization is used, see o2m2

q_thresh

Integer. If Y has more than q_thresh columns, a power method optimization is used, see o2m2

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

The use of this function is to calculate the R2 of the joint part, while varying the number of orthogonal components. Adding more joint components will increase the R2!

A parallelized version is built in -tested on windows-, use package parallel and set parall=TRUE to activate this. There should not be already a cluster object with the name cl. In case of some error, don't forget to invoke stopCluster(cl) to end the cluster. See Task Manager (Windows) to verify that the workers are spanned/ended.

See loocv for more intuition.

Value

Matrix with two rows:

adjR2X

Contains the joint R2 in X

adjR2Y

Contains the joint R2 in Y


selbouhaddani/OmicsPLS documentation built on Aug. 25, 2022, 9:52 p.m.