Dear all, I am trying to do a PLS regression using plsr() from the pls package. I have tried to make a dataset according to the methods recommended in "Introduction to the pls Package" (Mevik & Wehrens, 2015) and it looks like I get a structure in the dataset that resembles what is packed with the package:
> str(gasoline) 'data.frame': 60 obs. of 2 variables: $ octane: num 85.3 85.2 88.5 83.4 87.9 ... $ NIR : AsIs [1:60, 1:401] -0.0502 -0.0442 -0.0469 -0.0467 -0.0509 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr "1" "2" "3" "4" ... .. ..$ : chr "900 nm" "902 nm" "904 nm" "906 nm" ... > str(lid_allt2) 'data.frame': 223 obs. of 2 variables: $ DON : num 55 55 55 55 55 55 55 55 55 55 ... $ lid_nose: 'AsIs' chr [1:223, 1:192] "215.074835" "203.803736" "197.364614" "192.765756" ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr "1" "2" "3" "4" ... .. ..$ : chr "n1" "n2" "n3" "n4" ... Where "gasoline" is a dataset from the package and "lid_allt2" is my own dataset. The reason there are so many "55" in the example row in the str() call is that I have repeated measurments with an electronic nose, normally six repetition for each control measurement. When I try to explain the DON variable with "lid_nose", the plsr() accepts my coding but returns a error message after on second or so: > don1 <- plsr(DON ~ lid_nose, ncomp = 10, data = lid_allt2, validation = "LOO") Error in `[[<-.data.frame`(`*tmp*`, i, value = c(16088L, 14624L, 14080L, : replacement has 42816 rows, data has 223 I have clearly asked plsr() to do something very stupid, but what, and what should I do to come out a little better? Med v�nlig h�lsning/Best regards CG Pettersson Senior Scientific Advisor, PhD ______________________ Lantm�nnen Corporate R&D Phone: +46 10 556 19 85 Mobile: + 46 70 330 66 85 Email: cg.petters...@lantmannen.com<mailto:cg.petters...@lantmannen.com> Visiting Address: S:t G�ransgatan 160 A Address: Box 30192, SE-104 25 Stockholm Webb: http://www.lantmannen.com<http://www.lantmannen.com/> Registered Office: Stockholm Before printing, think about the environment [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.