Thanks for using mixOmics! You are currently using our latest version of mixOmics (6.31.4) which is under active development. For this new version of mixOmics, which will be released on Bioconductor in April, we have changed how we set the seed, instead of doing it outside the function you need to set seed as a argument in the tune.splsda function. We will share more details about the changes we have made to tune functions on our website soon, but in the meantime you can use the help files by running ?tune.splsda. We appreciate you using our latest version as you can help us in identifying any issues that may have arisen from the updates we have made! However if you would prefer to use the stable Bioconductor version of mixOmics (for example to keep your code consistent if you used that version before), you are welcome to do that too. I have written code below detailing how to install either the Github or Bioconductor versions of mixOmics and how to reproducibly run tune.splsda for both versions.
## set up example data
data(breast.tumors)
X = breast.tumors$gene.exp
Y = as.factor(breast.tumors$sample$treatment)
## mixOmics version 6.31.4 - development version on mixOmics
devtools::install_github("mixOmicsTeam/mixOmics", ref = "6.31.4", force = TRUE)
library(mixOmics)
# run tuning on test data twice with same seed set inside the function
tune = tune.splsda(X, Y, ncomp = 1, nrepeat = 5, folds = 10,
test.keepX = c(5, 10, 15),
seed = 20) # set for reproducibility of example only
tune$choice.keepX # 10
tune = tune.splsda(X, Y, ncomp = 1, nrepeat = 5, folds = 10,
test.keepX = c(5, 10, 15),
seed = 20) # set for reproducibility of example only
tune$choice.keepX # 10
## mixOmics version 6.30.0 - stable version on Bioconductor
BiocManager::install("mixOmics", force = TRUE)
library(mixOmics)
# run tuning on test data twice with same seed set outside function - creates reproducible result
set.seed(10)
tune = tune.splsda(X, Y, ncomp = 1, nrepeat = 5, folds = 10,
test.keepX = c(5, 10, 15))
tune$choice.keepX # 10
set.seed(10)
tune = tune.splsda(X, Y, ncomp = 1, nrepeat = 5, folds = 10,
test.keepX = c(5, 10, 15))
tune$choice.keepX # 10