Learn R Programming

ipred (version 0.4-6)

kfoldcv: Subsamples for k-fold Cross-Validation

Description

Computes feasible sample sizes for the k groups in k-fold CV if N/k is not an integer.

Usage

kfoldcv(k, N)

Arguments

k
number of groups.
N
total sample size.

Value

  • A vector of length k.

Details

If N/k is not an integer, k-fold CV is not unique. Determine meaningful sample sizes.

Examples

Run this code
# 10-fold CV with N = 91

kfoldcv(10, 91)	

<testonly>k <- sample(5:15, 1)
k
N <- sample(50:150, 1)
N
stopifnot(sum(kfoldcv(k, N)) == N)</testonly>

Run the code above in your browser using DataLab