# NOT RUN {
## First example: analysis with sPLS-DA
# }
# NOT RUN {
data(breast.tumors)
X = breast.tumors$gene.exp
Y = as.factor(breast.tumors$sample$treatment)
tune = tune.splsda(X, Y, ncomp = 1, nrepeat = 10, logratio = "none",
test.keepX = c(5, 10, 15), folds = 10, dist = "max.dist",
progressBar = TRUE)
# 5 components, optimising 'keepX' and 'ncomp'
tune = tune.splsda(X, Y, ncomp = 5, test.keepX = c(5, 10, 15),
folds = 10, dist = "max.dist", nrepeat = 5, progressBar = TRUE)
tune$choice.ncomp
tune$choice.keepX
plot(tune)
# }
# NOT RUN {
## only tune component 3 and 4
# keeping 5 and 10 variables on the first two components respectively
# }
# NOT RUN {
tune = tune.splsda(X = X,Y = Y, ncomp = 4,
already.tested.X = c(5,10),
test.keepX = seq(1,10,2), progressBar = TRUE)
# }
# NOT RUN {
## Second example: multilevel one-factor analysis with sPLS-DA
# }
# NOT RUN {
data(vac18)
X = vac18$genes
Y = vac18$stimulation
# sample indicates the repeated measurements
design = data.frame(sample = vac18$sample)
tune = tune.splsda(X, Y = Y, ncomp = 3, nrepeat = 10, logratio = "none",
test.keepX = c(5,50,100),folds = 10, dist = "max.dist", multilevel = design)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab