Skip to content
Prev 274735 / 398506 Next

problem in exceuting PLS

On 18.10.2011 11:03, arunkumar1111 wrote:
There are only 7 columns in your data.
Why NULL?
Better: for(i in seq_along(variable))
Or even better, forget about that loop!

X <- as.matrix(Data[,4:8])

seems to be the fast way without any loop - but again, there is no 8th 
column in your data.
What's wrong with
  dataset$Y <- Data[,depVar]
Looks like you are talking about the pls package (unstated!)?

Then, just forget everything from before and just read in the data and 
apply:

fit1 <- mvr(Y ~ X2 + X3 + X4 + X5 + X6, data=Data, ncomp=4)

you do not need all that preprocessing!
I get:

ummary(mvr(Y ~ X2 + X3 + X4 + X5 + X6, data=Data, ncomp=4))
Data:   X dimension: 5 5
         Y dimension: 5 1
Fit method: kernelpls
Number of components considered: 4
TRAINING: % variance explained
    1 comps  2 comps  3 comps  4 comps
X    99.73    99.85   100.00      100
Y    78.51    99.81    99.98      100


Uwe Ligges