cv_average: Average fit measures computed in the K-fold cross-validation...

View source: R/cv_average.R

cv_averageR Documentation

Average fit measures computed in the K-fold cross-validation procedure

Description

Function to average results from an array of K-fold CV fit measures.

Usage

cv_average(cv_array, fit_measure)

Arguments

cv_array

Q \times nthrs \times K array containing fit measures computed for different combinations of the number of components, threshold values, and number of CV-folds.

fit_measure

character vector of length 1 indicating the type of fit measure to be used in the to cross-validation procedure

Details

The input of this function is an array of Q \times nthrs \times K, where Q is the number of principal components, nthrs is the number of thresholds, and K is the number of folds.

Value

list of three Q \times nthrs matrices:

  • scor: contains the average CV scores across the K folds

  • scor_upr: contains the average CV scores across the K folds + 1 standard deviation

  • scor_lwr: contains the average CV scores across the K folds - 1 standard deviation

Author(s)

Edoardo Costantini, 2023

Examples

# Example inputs
cv_array = array(abs(rnorm(10 * 3 * 2)), dim = c(10, 3, 2))
fit_measure = "F"

# Use the function
cv_average(cv_array, fit_measure)


gspcr documentation built on May 29, 2024, 2:44 a.m.