cvtype function

Generating test dataset index for cross-validation

Generating test dataset index for cross-validation

This function generates test dataset index for cross-validation.

cvtype(n, cv.bsize=1, cv.kfold, cv.random=FALSE)

Arguments

  • n: the number of observation
  • cv.bsize: block size of cross-validation
  • cv.kfold: the number of fold of cross-validation
  • cv.random: whether or not random cross-validation scheme should be used. Set cv.random=TRUE for random cross-validation scheme

Details

This function provides index of test dataset according to various cross-validation scheme. One may construct K test datasets in a way that each testset consists of blocks of b consecutive data. Set cv.bsize = b for this. To select each fold at random, set cv.random = TRUE. See Kim et al. (2012) for detalis.

Returns

matrix of which row is test dataset index for cross-validation

References

Kim, D., Kim, K.-O. and Oh, H.-S. (2012) Extending the Scope of Empirical Mode Decomposition using Smoothing. EURASIP Journal on Advances in Signal Processing, 2012:168 , doi: 10.1186/1687-6180-2012-168.

Examples

# Traditional 4-fold cross-validation for 100 observations cvtype(n=100, cv.bsize=1, cv.kfold=4, cv.random=FALSE) # Random 4-fold cross-validation with block size 2 for 100 observations cvtype(n=100, cv.bsize=2, cv.kfold=4, cv.random=TRUE)
  • Maintainer: Donghoh Kim
  • License: GPL (>= 3)
  • Last published: 2022-01-04

Useful links