Error in ROPLS with LPS-DA
4
0
Entering edit mode
@abigailrandall85-15234
Last seen 6.8 years ago

Hi, 

I'm relative new to R and ROPLS so please forgive any errors in this message.

I am trying to perform a PLS-DA analysis using the ROPLS package on some NMR data in an R object 'sunoesy' (less the first four columns which contain non-numeric data). The y response is a categorical factor 'treatment'. After running the code I get the following error message:

sunoesy.lpsda<-opls(sunoesy[,-c(1:4)], treatment)
Error in if (ncol(ynMN) == 1 || drop(sqrt(crossprod((tOldVn - tVn)/tVn))) <  : 
  missing value where TRUE/FALSE needed

I have been through my data object 'sunoesy' and there are no missing values or NAs. I suspect that the kind of error described here might be occurring (https://stackoverflow.com/questions/20541883/weird-error-in-r), but I don't know how to go about sorting this out given I am using pre-defined code within an r package.

 

Many thanks for any assistance.

 

 

Abigail x

 

 

 

ROPLS LPS-DA • 2.2k views
ADD COMMENT
0
Entering edit mode
@etiennethevenot-8285
Last seen 23 months ago
France

Hi Abigail,

Did you check that there is any variable with constant value for all samples in your dataset?

Otherwise, could you share your "sunoesy" data with me (etienne.thevenot@cea.fr)?

Best wishes,

Etienne.

ADD COMMENT
0
Entering edit mode
@abigailrandall85-15234
Last seen 6.8 years ago

Dear Etienne,

I don't think there are any variables with constant values. I have sent you the data over so you can assess. Thanks so much for your help.

 

Abigail

ADD COMMENT
0
Entering edit mode
@etiennethevenot-8285
Last seen 23 months ago
France

Hi Abigail,

I ran the script below on your data (PCA and PLS-DA) without any error.

The modeling with PLS-DA does not appear significant (pQ2 = 0.1). In addition, since you have 1e3 times more variables than samples, the risk of overfitting is very high.

Best wishes,

Etienne.

sunDF <- read.table("sunoesy.csv",
                    header = TRUE,
                    sep = ",",
                    stringsAsFactors = FALSE)
library(ropls)
strF(sunDF)

datMN <- as.matrix(sunDF[, -c(1:5)])
samDF <- sunDF[, 3:5]
rownames(samDF) <- rownames(datMN) <- sunDF[, "X"]

## PCA

pcaMod <- opls(datMN, predI = 2)
plot(pcaMod, parAsColFcVn = samDF[, "Treatment"])

## PLS-DA

opls(datMN, samDF[, "Treatment"], predI = 2)

 

ADD COMMENT
0
Entering edit mode
@abigailrandall85-15234
Last seen 6.8 years ago

Dear Etienne,

Thank you very much for your help with this. I have run the code you suggested and it works for me too. I think I may have made a relatively simply error to do with including an extra column of metadata in the columns used for PLS. My apologies, and thanks for your help.

 

Abigail

ADD COMMENT

Login before adding your answer.

Traffic: 669 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