I want to perform PLS analysis. When I write
Result <- plsr (X ~ Y, 10, data = xxx, validation = "LOO")
showing the following error
Error in colMeans (Y): 'x' must be numeric In addition: Warning message: In model.response (mf, "numeric"): Using type = "numeric" with a factor response will be ignored
X <- 0.954242509 0 1.579783597 0 1.51851394 <na> 1.397940009 1.079181246 1.079181246 0 0.698970004 [12] 0.301029996 <na> 0.84509804 0 0.698970004 0.602059991 0.954242509 0.698970004 0.301029996 <na> 1.230448921 [23] 2.103803721 <na> 1.944482672 <na> 0 0.777815125 1.041392685 <na> 0.301029996 <na> 0.602059991 Y <- 0.000760376 0.026700304 0.014669871 0.000169903 0.020560227 <na> 0.000205013 0.033492921 0.025880333 5.26211E-05 0.012691444
Can someone help me, please?
Gabriela Vera
I did everything you told me, but I did not solve it, the same error appears.
Previously, he had tried to transform the variables by: X.num <- as.numeric (tdata $ X), however it changes the number of quantification.
I run again and I get a result but I do not know if this way is correct?
what is your whole code like?
Data.1 <- read.csv("File.csv",header = TRUE, sep = ";")
valid = !is.na(Data.1$variable1)|is.na(Data.1$variable2)) Datareduced = Data.1[valid,c("variable1","variable2")]
Result <- plsr(variable1~ variable2, 10, data = Datareduced, validation = "LOO")
variable1<- 0.000760376 0.026700304 0.014669871 0.000169903 0.020560227 0.000205013 0.033492921 0.025880333 5.26211E-05 0.01269144