PLS weights are not orthagonal

3 views (last 30 days)
Atticus Beachy
Atticus Beachy on 10 Jul 2019
Commented: Atticus Beachy on 27 Mar 2021
When I compute PLS weights using matrix operations, the weights are orthagonal to each other.
When I compute them using plsregress they are not.
See example code below:
load spectra
X = NIR;
Y = octane;
% Compute first two weights using matrix operations
X1 = X - mean(X, 1)
Y1 = Y - mean(Y, 1)
w1 = X1'*Y1/(norm(X1'*Y1));
t1 = X1*w1;
c1 = t1'*Y1/(t1'*t1);
p1 = X1'*t1/(t1'*t1);
X2 = X1 - t1*p1';
Y2 = Y1 - t1*c1;
w2 = X2'*Y2/(norm(X2'*Y2));
t2 = X2*w2;
c2 = t2'*Y2/(t2'*t2);
p2 = X2'*t2/(t2'*t2);
W = [w1, w2];
W = W./vecnorm(W); % normalize
% Compute first two weights using plsregress
ncomp = 2;
[XL, YL, XS, YS, BETA, PercentVar, ~, stats] = plsregress(X, Y, ncomp);
W_mat = stats.W./vecnorm(stats.W)
% compare weights (first weights are identical, second are not)
[W, W_mat]
The dot product of two orthagonal vectors is 0. Checking the weights for orthagonality:
dot(W(:,1), W(:,2))
ans =
-5.6812e-17
dot(W_mat(:,1), W_mat(:,2))
ans =
0.4488
Shouldn't the weights be orthagonal, or am I missing something? Can anyone explain what is going on here?
  2 Comments
Arthur Ryzak
Arthur Ryzak on 7 Dec 2020
You are using the NIPALS algorithm and Matlab plsregress uses the SIMPLS algorithm. These two algorithms compute the weights in different ways. I do not believe the weights in SIMPLS are supposed to be orthogonal.
Quoted here is a very relevant excerpt from a webpage that explains some of the differences: "So the somewhat odd thing about the weight vectors w derived from NIPALS is that each one applies to a different X, i.e. tn+1 = Xnwn+1. This is in contrast to Sijmen de Jong’s SIMPLS algorithm introduced in 1993 [3]. In SIMPLS a set of weights, sometimes referred to as R, is calculated, which operate on the original X data to calculate the scores. Thus, all the scores T can be calculated directly from X without deflation, T = XR. de Jong showed that it is easy to calculate the SIMPLS R from the NIPALS W and P, R = W(P’W)-1. (Unfortunately, I have, as yet, been unable to come up with a simple expression for calculating the NIPALS W from the SIMPLS model parameters.) "
S. de Jong, “SIMPLS: an alternative approach to partial least squares regression,” Chemo. and Intell. Lab. Sys., Vol. 18, 251-263, 1993.
https://eigenvector.com/different-kinds-of-pls-weights-loadings-and-what-to-look-at/
Atticus Beachy
Atticus Beachy on 27 Mar 2021
Thanks! That clarifies things.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!