## First example: one-factor analysis with sPLS-DA
data(data.simu) # simulated data
result.ex1 = tune.multilevel(data.simu$X,
cond = data.simu$stimu,
sample = data.simu$sample,
ncomp=2,
test.keepX=c(5, 10, 15),
already.tested.X = c(50),
method = 'splsda',
dist = 'mahalanobis.dist',
validation = 'loo')
result.ex1
## Second example: two-factor analysis with sPLS-DA
data(liver.toxicity)
dose = liver.toxicity$treatment$Dose.Group
time = liver.toxicity$treatment$Time.Group
dose.time = cbind(dose, time)
repeat.indiv = c(1,2, 1, 2, 1, 2, 1, 2, 3, 3, 4,
3, 4, 3, 4, 4, 5, 6, 5, 5, 6, 5, 6, 7, 7,
8, 6, 7, 8, 7, 8, 8, 9, 10, 9, 10, 11, 9, 9,
10, 11, 12, 12, 10, 11, 12, 11, 12, 13, 14, 13, 14, 13,
14, 13, 14, 15, 16, 15, 16, 15, 16, 15, 16)
result.ex2 = tune.multilevel (liver.toxicity$gene,
cond = dose.time,
sample = repeat.indiv,
ncomp=2,
test.keepX=c(5, 10, 15),
already.tested.X = c(50),
method = 'splsda',
dist = 'mahalanobis.dist')
result.ex2
## Third example: one-factor integrative analysis with sPLS
result.ex3 = tune.multilevel (liver.toxicity$gene, liver.toxicity$clinic,
cond = dose,
sample = repeat.indiv,
ncomp=2,
test.keepX=c(5, 10, 15),
test.keepY=c(2,3),
already.tested.X = c(50), already.tested.Y = c(5),
method = 'spls')
result.ex3
Run the code above in your browser using DataLab