Data arrangement for PLSDA using the ropls R-package
1
0
Entering edit mode
@michaeleisenring-13974
Last seen 4.2 years ago

I would like to do a partial least square discriminant analysis (PLSDA) in R using the package “ropls”

In my PLSDA the impact of two genders (AP,C) on 5 compounds measured in persons (samples) should be illustrated. 

However, when I try to do a PLSDA I get the warning message:

“Single component model: only 'overview' and 'permutation' (in case of single response (O)PLS(-DA)) plots available”

I assume it has something to do with the way I arrange my data into R. I tried to do it in a similar way as it has been done in the example of the package using the sacurine data set bioconductor.org/packages/release/bioc/vignettes/ropls/inst/doc/ropls-vignette.pdf

Can somebody maybe tell me how I correctly have to arrange my data in order to perfom a PLSDA using the “ropls” package?

Thank you very much,

Mike

Please find my code  and the sessinInfo() below. since I had trouble with the language detector i could not upload an example data set. But I uploaded some screeshots of the data structure

CODE:

#Input data and convert to data frame and define "Sample" as row

dta<-read.csv("Demo.csv",sep=";",header=T)

rownames(dta)<-dta$Sample

dta

#Picture of data structure

https://imgur.com/cAQN5l3

 

#Remove non-numeric "Sample" and "Gender" rows and convert to matrix

dta.exp<-dta[,c(-1,-7)]

matrix<-as.matrix(dta.exp)

matrix

#Picture of matrix structure

https://imgur.com/VLORhU0

https://imgur.com/DE0SEAL

#create vector with "gender" as y-component

dta.treatments<-dta[,7]

dta.treatments

dta.factor<-as.factor(dta.treatments)

dta.plsda <- opls(matrix, dta.factor)

 

 

 

 

SESSION INFO

sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=German_Switzerland.1252  LC_CTYPE=German_Switzerland.1252  
[3] LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C                      
[5] LC_TIME=German_Switzerland.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ropls_1.8.0

loaded via a namespace (and not attached):
[1] compiler_3.4.1      parallel_3.4.1      tools_3.4.1         Biobase_2.36.2    
[5] BiocGenerics_0.22.0

plsda ropls • 1.2k views
ADD COMMENT
2
Entering edit mode
@etiennethevenot-8285
Last seen 4 months ago
France

Hi Mike,

In your dataset, the algorithm finds that the optimal number of component is 1. Hence, a score plot in two-dimensions is not returned.

By setting the number of predictive components to 2 (with 'predI = 2'), you will force the algorithm to compute the second component and thus the score-plot will be available.

Best wishes,

Etienne.

ADD COMMENT

Login before adding your answer.

Traffic: 356 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6