kfcv: Sample sizes for k-fold cross-validation

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/kfcv.R

Description

Compute sample sizes for k-fold cross-validation.

Usage

1
kfcv(k, N)

Arguments

k

number of groups.

N

total sample size.

Details

If N/k is an integer, the sample sizes are k ‘N/k’s (N/k, N/k, ...), otherwise the remainder will be allocated to each group as ‘uniformly’ as possible, and at last these sample sizes will be permuted randomly.

Value

A vector of length k containing k sample sizes.

Author(s)

Yihui Xie

See Also

cv.ani

Examples

1
2
3
4
5
## divisible
kfcv(5, 25)

## not divisible
kfcv(10, 77)

Example output

sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
[1] 5 5 5 5 5
 [1] 8 8 8 7 7 8 8 8 7 8

animation documentation built on Oct. 7, 2021, 9:18 a.m.