Description Usage Arguments Details Value
For (a grid of) values for a
, nx
and ny
, loocv
estimates the prediction error using k-fold CV.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
X |
Numeric matrix. Vectors will be coerced to matrix with |
Y |
Numeric matrix. Vectors will be coerced to matrix with |
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. |
fitted_model |
List. Deprecated. O2PLS model fit with |
func |
Function to fit the O2PLS model with. Only |
app_err |
Logical. Deprecated. Should the apparent error also be computed? |
kcv |
Integer. The value of k, i.e. the number of folds. Choose N for LOO-CV. |
stripped |
Logical. Use the stripped version of o2m (usually when cross-validating)? |
p_thresh |
Integer. If |
q_thresh |
Integer. If |
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. |
Note that this function can be easily parallelized (on Windows e.g. with the parallel
package.).
The parameters a
, a2
and b2
can be integers or vectors of integers. A for loop is used to loop over all combinations.
The resulting output is a list, which is more easy to interpret if you use array(unlist(output_of_loocv$CVerr))
as in the example below.
The array wil have varying a
along the first dimension and a2
and b2
along the second and third respectively.
Typing example(loocv)
(hopefully) clarifies this function.
List with two numeric vectors:
CVerr |
Contains the k-fold CV estimated RMSEP |
Fiterr |
Contains the apparent error |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.