crossval_sparsity: Perform cross-validation to find the optimal number of...

Description Usage Arguments Value

View source: R/Crossval_OmicsPLS.R

Description

Perform cross-validation to find the optimal number of variables/groups to keep for each joint component

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
crossval_sparsity(
  X,
  Y,
  n,
  nx,
  ny,
  nr_folds,
  keepx_seq = NULL,
  keepy_seq = NULL,
  groupx = NULL,
  groupy = NULL,
  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

nr_folds

Integer. Number of folds of CV

keepx_seq

Numeric vector. A vector indicating how many variables/groups to keep for CV in each of the joint component of X. Sparsity of each joint component will be selected sequentially.

keepy_seq

Numeric vector. A vector indicating how many variables/groups to keep for CV in each of the joint component of Y. Sparsity of each joint component will be selected sequentially.

groupx

Vector. Used when sparse = TRUE. A vector of strings indicating group names of each X-variable. Its length must be equal to the number of variables in X. The order of group names must corresponds to the order of the variables.

groupy

Vector. Used when sparse = TRUE. A vector of strings indicating group names of each Y-variable. The length must be equal to the number of variables in Y. The order of group names must corresponds to the order of the variables.

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.

Value

A list containing

x_1sd

A vector with length n, giving the optimal number of variables/groups to keep for each X-joint compoent. One standard error rule is applied

y_1sd

A vector with length n, giving the optimal number of variables/groups to keep for each Y-joint compoent. One standard error rule is applied

x

A vector with length n, giving the optimal number of variables/groups to keep for each X-joint compoent, without applying the one standard error rule

y

A vector with length n, giving the optimal number of variables/groups to keep for each Y-joint compoent, without applying the one standard error rule


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