Records are ordered by year and cut into k blocks of consecutive years
with about equal numbers of records; each block is a fold. Holding out
the latest block tests prediction forward in time, the situation of a
model used to predict change (Roberts et al. 2017). Records of one year
always stay in one fold.
Value
An integer vector of folds (1 = earliest years), with attribute
years (the range of years of each fold).
Details
Status and limits. An established design (temporal blocking;
Roberts et al. 2017). Records of different periods also differ in
recording effort and methods, so a drop in performance may reflect
recording as much as change. What to vary. k.
References
Roberts, D.R., Bahn, V., Ciuti, S., et al. (2017) Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogenetic structure. Ecography 40, 913-929. doi:10.1111/ecog.02881
Examples
temporal_folds(c(1950, 1960, 1970, 1980, 1990, 2000, 2010, 2020), k = 4)
#> [1] 1 1 2 2 3 3 4 4
#> attr(,"years")
#> [1] "1950-1960" "1970-1980" "1990-2000" "2010-2020"
