opls_cv_cpp: Internal Cpp function for performing leave-group-out...

View source: R/RcppExports.R

opls_cv_cppR Documentation

Internal Cpp function for performing leave-group-out cross-validations for pls regression

Description

For internal use only!.

Usage

opls_cv_cpp(X, Y, scale, method, 
                  mindices, pindices, 
                  min_component, ncomp, 
                  new_x, 
                  maxiter, tol, 
                  wapls_grid, 
                  algorithm, 
                  statistics = TRUE)

Arguments

X

a matrix of predictor variables.

Y

a matrix of a single response variable.

scale

a logical indicating whether the matrix of predictors (X) must be scaled.

method

the method used for regression. One of the following options: 'pls' or 'wapls' or 'completewapls1p'.

mindices

a matrix with n rows and m columns where m is equivalent to the number of resampling iterations. The elements of each column indicate the indices of the observations to be used for modeling at each iteration.

pindices

a matrix with k rows and m columns where m is equivalent to the number of resampling iterations. The elements of each column indicate the indices of the observations to be used for predicting at each iteration.

min_component

an integer indicating the number of minimum pls components (if the method = 'pls').

ncomp

an integer indicating the number of pls components.

new_x

a matrix of one row corresponding to the observation to be predicted (if the method = 'wapls').

maxiter

maximum number of iterations.

tol

limit for convergence of the algorithm in the nipals algorithm.

wapls_grid

the grid on which the search for the best combination of minimum and maximum pls factors of 'wapls' is based on in case method = 'completewapls1p'.

algorithm

either pls ('pls') or modified pls ('mpls'). See get_weigths function.

statistics

a logical value indicating whether the precision and accuracy statistics are to be returned, otherwise the predictions for each validation segment are retrieved.

Value

if statistics = true a list containing the following one-row matrices:

  • rmse_seg the RMSEs.

  • st_rmse_seg the standardized RMSEs.

  • rsq_seg the coefficients of determination.

if statistics = false a list containing the following one-row matrices:

  • predictions the predictions of each of the validation segments in pindices. Each column in pindices contains the validation indices of a segment.

  • st_rmse_seg the standardized RMSEs.

  • rsq_seg the coefficients of determination.

If method = "wapls", data of the pls weights are output in this list(compweights).

If method = "completewapls1", data of all the combination of components passed in wapls_grid are output in this list(complete_compweights).

Author(s)

Leonardo Ramirez-Lopez


l-ramirez-lopez/resemble documentation built on April 20, 2023, 10:44 p.m.