I executed the following code:

X=matrix(rnorm(500),nrow=100,ncol=5)

Y=rbinom(100,1,0.5)

model_fake=plsda(X,Y,ncomp=3)

model_fake$X %*% model_fake$loadings.star[[1]]

model_fake$variates$X

And the output of line #4 and line #5 isn’t the same. Interestingly, they are exactly the same when ncomp=2.

Can anybody explain why this is the case, and is it possible to calculate variates from loadings.star (or loadings) and original matrix when n>2? Thank you so much!