{"id":149,"date":"2012-03-16T05:23:45","date_gmt":"2012-03-16T05:23:45","guid":{"rendered":"http:\/\/pageperso.math.univ-toulouse.fr\/mixomics\/"},"modified":"2013-08-06T05:43:36","modified_gmt":"2013-08-06T05:43:36","slug":"spls-da","status":"publish","type":"page","link":"https:\/\/perso.math.univ-toulouse.fr\/mixomics\/methods\/spls-da\/","title":{"rendered":"(s)PLS-DA"},"content":{"rendered":"<h2><em>PLS Discriminant Analysis (PLS-DA)<\/em><\/h2>\n<p>&#8230;is a classical PLS regression (with a regression mode) but where the response variable is categorical. i.e. indicates the classes\/categories of the samples. PLS-DA has often been used for classification and discrimination problems (i.e. supervised classification), even though PLS was not originally designed for this purpose. The response vector Y is qualitative and is recoded as a dummy block matrix where each of the response categories are coded via an indicator variable. PLS-DA is then run as if Y was a continuous matrix. Note that this might be wrong from a theoretical point of view, however, it has been previously shown that this works well in practice.<\/p>\n<p>The parameters to choose by the user here is the number of components or dimensions ncomp, it is usually set to k -1 where k is the number of classes.<\/p>\n<h2><em>Sparse PLS Discriminant Analysis (sPLS-DA)<\/em><\/h2>\n<p>&#8230;is based on the same concept as sPLS to allow variable selection, except that this time, the variables are only selected in the X data set and in a supervised framework, i.e. we are selecting the X-variables with respect to different categories of the samples.<\/p>\n<p>The parameters to choose by the user here is the number of components or dimensions ncomp and the number of variables to choose in the X data set keepX. See the SRBCT case study that illustrates some criteria to choose these parameters.<\/p>\n<h2><em>Usage in mixOmics<\/em><\/h2>\n<p>(s)PLS-DA is implemented in mixOmics via the functions plsda and splsda as displayed below. For both plsdaand splsda, we strongly advise to work with a training and a testing set (see the function predict). For now, we only illustrate the two approached on the full &#8216;training&#8217; set.<\/p>\n<p>Remember that you are only selecting the variables in the X data set. Y data should be entered as a factor.<\/p>\n<pre style=\"border: 1px solid black;font-size: 9pt\">data(liver.toxicity)\r\nX &lt;- as.matrix(liver.toxicity$gene)\r\nY &lt;- as.factor(liver.toxicity$treatment[, 4]) # Y is a factor, we chose it as the\r\n                                              # time points of necropsy              \r\n\r\n## PLS-DA function\r\nresult &lt;- plsda(X, Y, ncomp = 3) # where ncomp is the number of components wanted\r\n\r\n## sPLS-DA function\r\nresult &lt;- splsda(X, Y, ncomp = 3, keepX = c(10, 10, 10)) # where keepX is the number\r\n                                                         # of variables selected\r\n                                                         # for each components<\/pre>\n<p>With (s)PLS-DA, the classes of new samples or observations can be predicted in the model by using thepredict function. This is an example to perform 3-fold cross-validation. Normally 10-fold cross-validation should be performed several times and the results should be averaged to get a better estimation of the generalization performance:<\/p>\n<pre style=\"border: 1px solid black;font-size: 9pt\">data(liver.toxicity)\r\nX &lt;- as.matrix(liver.toxicity$gene)\r\nY &lt;- as.factor(liver.toxicity$treatment[, 4]) # Y is a factor, we chose it as\r\n                                              # the time points of necropsy\r\ni &lt;- 1\r\nsamp &lt;- sample(1:3, nrow(X), replace = TRUE) # Creation of a list of the same size\r\n                                             # as X containing 1, 2 or 3\r\n\r\ntest &lt;- which(samp == i) # Search which column in samp has a value of 1\r\ntrain &lt;- setdiff(1:nrow(X), test) # Keeping the column that are not in test\r\n\r\n## For PLS-DA\r\nplsda.train &lt;- plsda(X[train, ], Y[train], ncomp = 3)\r\ntest.predict &lt;- predict(plsda.train, X[test, ], method = \"max.dist\")\r\n\r\n## For sPLS-DA\r\nsplsda.train &lt;- splsda(X[train, ], Y[train], ncomp = 3, keepX = c(10, 10, 10))\r\ntest.predict &lt;- predict(splsda.train, X[test, ], method = \"max.dist\")<\/pre>\n<p>see also [intlink id=&#8221;spls-dasrbct&#8221;]sPLS-DA:srbct[\/intlink] case study<\/p>\n<h3><em>References -in addition to from [intlink id=&#8221;spls&#8221;](s)PLS[\/intlink]<\/em><\/h3>\n<ul>\n<li>P\u00e9rez-Enciso M. and Tenenhaus M. (2003) Prediction of clinical outcome with microarray data: a partial least squares discriminant analysis (PLS-DA) approach. Human Genetics 112, pp 581-592.<\/li>\n<li>Nguyen D.V. and Rocke D.M. (2002) Tumor classification by partial least squares using microarray gene expression data. Bioinformatics 18, pp 39-50.<\/li>\n<li>L\u00ea Cao K.-A., Boitard S. and Besse P. (2011) Sparse PLS Discriminant Analysis: biologically relevant feature selection and graphical displays for multiclass problems. Submitted.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>PLS Discriminant Analysis (PLS-DA) &#8230;is a classical PLS regression (with a regression mode) but where the response variable is categorical. i.e. indicates the classes\/categories of the samples. PLS-DA has often been used for classification and discrimination problems (i.e. supervised classification), even though PLS was not originally designed for this purpose. The response vector Y is [&hellip;]<\/p>\n","protected":false},"author":44,"featured_media":0,"parent":117,"menu_order":4,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-149","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/perso.math.univ-toulouse.fr\/mixomics\/wp-json\/wp\/v2\/pages\/149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/perso.math.univ-toulouse.fr\/mixomics\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/perso.math.univ-toulouse.fr\/mixomics\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/perso.math.univ-toulouse.fr\/mixomics\/wp-json\/wp\/v2\/users\/44"}],"replies":[{"embeddable":true,"href":"https:\/\/perso.math.univ-toulouse.fr\/mixomics\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":28,"href":"https:\/\/perso.math.univ-toulouse.fr\/mixomics\/wp-json\/wp\/v2\/pages\/149\/revisions"}],"predecessor-version":[{"id":22792,"href":"https:\/\/perso.math.univ-toulouse.fr\/mixomics\/wp-json\/wp\/v2\/pages\/149\/revisions\/22792"}],"up":[{"embeddable":true,"href":"https:\/\/perso.math.univ-toulouse.fr\/mixomics\/wp-json\/wp\/v2\/pages\/117"}],"wp:attachment":[{"href":"https:\/\/perso.math.univ-toulouse.fr\/mixomics\/wp-json\/wp\/v2\/media?parent=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}