getCVids: IDs for running cross validation

View source: R/getCVfoldID.R

getCVidsR Documentation

IDs for running cross validation

Description

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(s)

LAS Scott-Hayward, University of St Andrews

Examples

# load data
data(ns.data.re)

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


lindesaysh/MRSea documentation built on May 11, 2024, 11:30 p.m.