[!!!] // No description yet //

sp_manyroc_with_cv(
  Var,
  Spectra,
  k_folds = 5,
  times = 10,
  seeds = 2222222,
  kind = "L'Ecuyer-CMRG",
  n_min = k_folds
)

Arguments

Var

(character(1)\ factor)
Either the name of variable in Spectra which contains the grouping variable or a factor vector (or convertible to factor) with values for grouping.

Spectra

hyperSpec object, that contains colum ID for spectra blocking, columns with grouping variables as well as spectroscopic information.

k_folds

(positive integer)
The number of folds in k-fold cross-validation.

times

(positive integer)
The number of repetitions in repeated k-fold cross-validation.

seeds

(NULL | integer)
Either a vector of integers of length times to set seed for each repetition of k-fold cross-validation. For more about seeds see set.seed().

Each seed will be passed to cvo_create_folds.()

kind

character or NULL. If kind is a character string, set R's RNG to the kind desired. Use "default" to return to the R default. See ‘Details’ for the interpretation of NULL.

n_min

integer(1)
minimum acceptable number of unique samples per group. Must be at least k_folds or bigger.

Details

Function sp_manyroc_with_cv will be renamed in the future.

See also

Examples

library(manyROC) fluorescence$ID <- 1:nrow(fluorescence) sp_manyroc_with_cv("gr", fluorescence[, , 500 ~ 502], k_folds = 3, times = 2)
#> $variable #> [1] "gr" #> #> $n_included #> [1] 150 #> #> $ind_included_rows #> 'as_str' logi [1:150] TRUE TRUE TRUE TRUE TRUE TRUE ... #> #> $cvo #> --- A cvo object: ---------------------------------------------------- #> indices stratified blocked cv_type k repetitions sample_size #> Train TRUE FALSE Repeated k-fold 3 2 150 #> #> Random number generator: L'Ecuyer-CMRG #> Seeds: 2222222, -30397663 #> ---------------------------------------------------------------------- #> #> $results #> set fold compared_groups feature median_neg cutoff median_pos #> 1 training Rep1_Fold1 A vs. B 1 341 335 324 #> 2 training Rep1_Fold1 A vs. C 1 341 306 344 #> 3 training Rep1_Fold1 B vs. C 1 324 343 344 #> 4 training Rep1_Fold2 A vs. B 1 338 348 334 #> ... ... ... ... ... ... ... ... #> 105 test Rep2_Fold2 B vs. C 3 NA 340 NA #> 106 test Rep2_Fold3 A vs. B 3 NA 335 NA #> 107 test Rep2_Fold3 A vs. C 3 NA 322 NA #> 108 test Rep2_Fold3 B vs. C 3 NA 256 NA #> #> tp fn fp tn sens spec ppv npv bac youden kappa auc #> 1 26 11 14 21 0.70 0.60 0.65 0.66 0.65 0.30 0.30 0.63 #> 2 28 1 28 7 0.97 0.20 0.50 0.88 0.58 0.17 0.15 0.55 #> 3 16 13 8 29 0.55 0.78 0.67 0.69 0.67 0.34 0.34 0.66 #> 4 29 8 21 14 0.78 0.40 0.58 0.64 0.59 0.18 0.19 0.56 #> ... ... ... ... ... ... ... ... ... ... ... ... ... #> 105 7 7 1 17 0.50 0.94 0.88 0.71 0.72 0.44 0.47 NA #> 106 10 8 9 8 0.56 0.47 0.53 0.50 0.51 0.03 0.03 NA #> 107 3 12 6 11 0.20 0.65 0.33 0.48 0.42 -0.15 -0.16 NA #> 108 0 15 0 18 0.00 1.00 NaN 0.55 0.50 0.00 0.00 NA #> #>