Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

kfcv

Sample sizes for k-fold cross-validation


Description

Compute sample sizes for k-fold cross-validation.

Usage

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

Examples

## divisible
kfcv(5, 25)

## not divisible
kfcv(10, 77)

animation

A Gallery of Animations in Statistics and Utilities to Create Animations

v2.6
GPL
Authors
Yihui Xie [aut, cre], Christian Mueller [ctb], Lijia Yu [ctb], Weicheng Zhu [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.