randomiser {made4} | R Documentation |
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.
randomiser(ntrain = 77, ntest = 19)
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 |
Produces new indices that can be used for training/test datasets
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 |
Aedin Culhane
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)