randomiser {made4}R Documentation

Randomly reassign training and test samples

Description

This function is used to check for bias between a training and test data. It return a new index, which randomly re-assigns samples in the training data to the test dataset and vice versa.

Usage

randomiser(ntrain = 77, ntest = 19)

Arguments

ntrain Numeric. A integer indicating the number of cases in the training dataset
ntest Numeric. A integer indicating the number of cases in the test dataset

Details

Produces new indices that can be used for training/test datasets

Value

It returns a list, containing 2 vectors

train A vector of length ntrain, which can be used to index a new training dataset
test A vector of length ntest, which can be used to index a new test dataset

Author(s)

Aedin Culhane

Examples

randomiser(10,5)
train<-matrix(rnorm(400), ncol=20, nrow=20, dimnames=list(1:20,
paste("train",letters[1:20], sep=".")))
test<-matrix(rnorm(200), ncol=10, nrow=20, dimnames=list(1:20,
paste("test",LETTERS[1:10], sep=".")))
all<-cbind(train,test)

colnames(train)
colnames(test)
newInd<-randomiser(ntrain=20, ntest=10)

newtrain<-all[,newInd$train]
newtest<-all[,newInd$test]

colnames(newtrain)
colnames(newtest)


[Package made4 version 0.6 Index]