# [R] PLS: problem transforming scores to variable space

From: rainer grohmann <rainer.grohmann_at_gmx.net>
Date: Tue 05 Jul 2005 - 20:22:24 EST

Dear List!

I am trying to calculate the distance between original data points and their position in the PLS model. In order to do this, I tried to predict the scores using the predict.mvr function and calculate the corresponding positions in variable space.

The prediction of scores works perfectly:

data(trees)
# build model

t<-plsr(Volume~.,data=trees)

# predict scores for training data and compare:
# column 1: scores from model building
# column 2: scores obtained with predict.mvr
# column 3: scores from the corresponding matrix-multiplication
# only the first dimension is compared here.
# However, results the other component agrees as well
cbind(t\$scores[,1],

predict(t,trees,type="scores")[,1],
(scale(as.matrix(trees[,-3]),scale=FALSE,center=TRUE)%*%
t\$projection)[,1])

My guess was to use the loadings matrix. In order to check the results, I took the scores from the model, mapped them to variable space and mapped them back to scores using the predict function. The result of this procedure should again be the scores. I know the last step - prediting scores - works (see above). Therefore, if I ended up with the original scores after my transformations, I knew my first step - mapping of scores to variable space - was correct too, I would indeed obtain the original scores.
Obviously, I am mistaken (otherwise, I wouldn't ask you for help).

Here is, what I did (based on the code above)

# map scores to variable space and back to scores and compare:
# column 1: original scores from model building
# column 2: incorrectly mapped scores
# only the first dimension is compared here.
# However, results the other component disagrees as well

Any help or hint would be appreciated!

Rainer

> R.version

_
platform i686-pc-linux-gnu

arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    2
minor    1.0
year     2005
month    04
day      18
language R

--

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help