Search
Question: Error in ROPLS with LPS-DA
0
gravatar for abigailrandall85
3 months ago by
abigailrandall850 wrote:

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

 

 

 

ADD COMMENTlink modified 3 months ago • written 3 months ago by abigailrandall850
0
gravatar for etienne.thevenot
3 months ago by
France
etienne.thevenot0 wrote:

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 COMMENTlink written 3 months ago by etienne.thevenot0
0
gravatar for abigailrandall85
3 months ago by
abigailrandall850 wrote:

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 COMMENTlink written 3 months ago by abigailrandall850
0
gravatar for etienne.thevenot
3 months ago by
France
etienne.thevenot0 wrote:

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 COMMENTlink written 3 months ago by etienne.thevenot0
0
gravatar for abigailrandall85
3 months ago by
abigailrandall850 wrote:

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 COMMENTlink written 3 months ago by abigailrandall850
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 156 users visited in the last hour