How to get the data from tune.spls1.MAE

Hi,

hoping you are doing fine, Iam writing because I need to get access to the output of the tuning step, when the number of components and features is determined using sPLSR. I need to present this plot in a ms and I would like to be able to design it with ggplot. I’ve tried several ways to extract this information without success. would you be so kind of instructing me how to do it?

thank you very much

Cecilia

Hi @Cecilia ,

If I have understood correctly, you are looking to extract the MAE from the tune() function when running on a spls1 object. An example code of this would be:

data(liver.toxicity)
X <- liver.toxicity$gene
Y1 <- liver.toxicity$clinic[,1]
set.seed(42)
tune.res = tune.spls( X, Y1, ncomp = 3,
                      test.keepX = c(5, 10, 15),
                      test.keepY = c(3, 6, 8), measure = "MAE",
                      folds = 5, nrepeat = 3, progressBar = TRUE)

tune.res

The MAE measures are found within different slots of the resulting tune.res object. These slots are called error.rate, error.rate.sd and error.rate.all, depending on whether you want a mean or SD of the error rates calculated across repeats and folds. You can extract these values using tune.res$error.rate. You can also directly plot the MAE values across components and keep X variables using plot(tune.res).

I hope that helps!
Cheers,
Eva