sca.
nextdiff(S, P, withinblock, criterion)sccrit for details.P with one
new column appended.firstpcres(S,P) and subsequently
shrinkdiff(), the latter in a loop when
withinblock is true.In order to ensure uniqueness, we ensure that the first (non zero) entry of the principal component is always positive.
shrinkdiff; sca, also for references