Skip to contents

This function creates a string of integers which will be used for pointing to the right subsets of data for cross validation of regression objects

Usage

getCVids(data, folds, block = NULL, seed = NULL)

Arguments

data

data used in regression model

folds

integer number of validation data sets

block

column in data indicating the blocking structure for cross-validation (if block = NULL, individual observations will be used as blocks)

seed

integer number used to set the seed of the fold generation. By default this is set to NULL.

Details

The function returns a random sequence of 1:folds of the same length as observations in data. The seed used for generation is stored in the attributes (s.eed).

Author

LAS Scott-Hayward, University of St Andrews

Examples

# load data
data(ns.data.re)

CVids<-getCVids(ns.data.re, 5)