Dear All,
I am using mixOmics and facing trouble with sPLSDA tuning.
The error message is:
Error: Unexpected error while trying to choose the optimum number of components. Please check the inputs and if problem persists submit an issue to Issues · mixOmicsTeam/mixOmics · GitHub
Here is the code I use:
#set up the data as X expression matrix and Y as factor
X<-global_SL[,4:55]
Y<-global_SL$Matrix
summary(Y)
Milk Cheese Yogurt
12 12 12
#PLSDA analysis
data.plsda ← mixOmics::splsda(X, Y, ncomp = 10)
mixOmics::plotIndiv(data.plsda ,
comp = c(1,2),
group = Y,
ind.names = FALSE,
ellipse = TRUE,
legend = TRUE,
title = ‘PLSDA results’)
#undergo performance evaluation in order to tune the number of components to use
perf.plsda<- mixOmics::perf(data.plsda, validation = “Mfold”, folds = 3, nrepeat = 10,
progressBar = TRUE, auc = TRUE)
#plot the outcome of performance evaluation across all ten components
plot(perf.plsda, col = color.mixo(5:7), sd = TRUE,
legend.position = “horizontal”)
perf.plsda$choice.ncomp
max.dist centroids.dist mahalanobis.dist
overall 7 3 5
BER 7 3 5
#grid of possible keepX values that will be tested for each component
list.keepX ← c(1:10)
#undergo the tuning process to determine the optimal number of variables
tune.splsda<- mixOmics::tune.splsda(X, Y, ncomp = 5,
validation = ‘Mfold’,
folds = 3, nrepeat = 10, # use repeated cross-validation
dist = ‘max.dist’, # use max.dist measure
measure = “BER”, # use balanced error rate of dist measure
test.keepX = list.keepX)
Many thanks for your precious help
Emmanuelle
sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.utf8 LC_CTYPE=French_France.utf8 LC_MONETARY=French_France.utf8 LC_NUMERIC=C
[5] LC_TIME=French_France.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mixOmics_6.23.4 ggplot2_3.4.2 lattice_0.20-45 MASS_7.3-60 ropls_1.28.2