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
.
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
)
Matrix with two rows:
Contains the joint R2 in X
Contains the joint R2 in Y
Numeric matrix. Vectors will be coerced to matrix with as.matrix
(if this is possible)
Numeric matrix. Vectors will be coerced to matrix with as.matrix
(if this is possible)
Vector of integers. Contains the numbers of joint components.
Vector of integers. Contains the numbers of orthogonal components in \(X\).
Vector of integers. Contains the numbers of orthogonal components in \(Y\).
Function to fit the O2PLS model with. Only o2m
and o2m_stripped
are supported.
Integer. Should a parallel cluster be set up using package parallel
(Windows)? Best is to leave it to FALSE
.
Object of class 'cluster
'. If parall is TRUE
and cl
is not NULL
, calculations are parallelized over workers in cl.
Logical. Use the stripped version of o2m (usually when cross-validating)?
Integer. If X
has more than p_thresh
columns, a power method optimization is used, see o2m2
Integer. If Y
has more than q_thresh
columns, a power method optimization is used, see o2m2
Double. Threshold for which the NIPALS method is deemed converged. Must be positive.
Integer. Maximum number of iterations for the NIPALS method.
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.