Description Usage Arguments Details Value Author(s) Examples
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.
1 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.