Learn R Programming

o2plsda (version 0.0.26)

o2cv: Cross validation for O2PLS

Description

Cross validation for O2PLS

Usage

o2cv(
  X,
  Y,
  nc,
  nx,
  ny,
  group = NULL,
  nr_folds = 5,
  ncores = 1,
  scale = FALSE,
  center = FALSE
)

Value

a data frame with the Q and RMSE values

Arguments

X

a Numeric matrix (input)

Y

a Numeric matrix (input)

nc

Integer. Number of joint PLS components.

nx

Integer. Number of orthogonal components in X

ny

Integer. Number of orthogonal components in Y

group

a vector to indicate the group for Y

nr_folds

Integer to indicate the folds for cross validation

ncores

Integer. Number of CPUs to use for cross validation

scale

boolean values determining if data should be scaled or not

center

boolean values determining if data should be centered or not

Author

Kai Guo

Examples

Run this code
set.seed(123)
X = matrix(rnorm(500),50,10)
Y = matrix(rnorm(500),50,10)
X = scale(X, scale = TRUE)
Y = scale(Y, scale = TRUE)
# group factor could be omitted if you don't have any group 
group <- rep(c("Ctrl","Treat"), each = 25)
cv <- o2cv(X, Y, 1:2, 1:2, 1:2, group=group, nr_folds = 2, ncores=1)

Run the code above in your browser using DataLab