CVincompleteTrial: Function to make a CV scheme based on random sampling of...

Description Usage Arguments Details Value Author(s) Examples

Description

Function to make a CV scheme based on random sampling of entry IDs in an incomplete field trial setup.

Usage

1
CVincompleteTrial(ID, factorID, LOCATION, k, exclusive, seed)

Arguments

ID

character vector of the observation IDs. The names are a combination of the entry name and the location.

factorID

character vector of the entry IDs used in the randomization.

LOCATION

character describing the column name representing the location information.

k

integer value for the number of folds used in the k-cross-validation.

exclusive

logical whether sampling should be done with replacement. The argument is passed to the replace argument of the samp.int function as the negation, i.e. exclusive is TRUE means replace=FALSE, such that the probability of choosing the next item is proportional to the weights amongst the remaining items.

seed

numeric value for the seed value used for the randomization by the set.seed function. In this way randomization can be reproduced by the user. Default is NULL, which uses 123 as value for the seed.

Details

we developed our own functionality to simulate randomization for an incomplete field trial, which is based on permutation using the attached permute function. in the incomplete field trial setup we define an equal set of entries at every location, where we ensure no overlap in entry IDs during this process.

Value

named vector of numeric scores showing the assignment of the observations to their respective set used in the k-fold cross-validation.

Author(s)

Ruud Derijcker

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(exampleCV)
y <- exampleCV[,which(colnames(exampleCV) %in% c("GERMPLASM", "LOCATION"))]
colnames(y) <- c("IDUnique","FACTOR")
y$ID <- paste(y$IDUnique, y$FACTOR, sep="_")
y <- na.omit(y)
n <- length(y$ID)
output <- CVincompleteTrial(ID=y$ID, factorID=y$IDUnique, LOCATION=y$FACTOR,
                           seed=123, k=5, exclusive=TRUE)
table(output)
head(output)

digiYozhik/msc_thesis documentation built on May 14, 2019, 5:16 p.m.