User:Dfbeaton/sandbox

Partial least squares (PLS) (sometimes called Projection on Latent Structures) is an umbrella term for a variety of statistical methods that, in general, aim to explain the relationship between two matrices (say, X and Y). PLS works in a similar fashion to principal components analysis, canonical correlation, and principal components regression in that PLS takes a latent variable approach to modeling the covariance between X and Y.

There are three basic versions of PLS, each with a wide array of extensions. The term Partial Least Squares was introduced by Swedish statistician Herman Wold who developed the first PLS approach with his son, Svante Wold. The approach introduced by Wold is commonly called PLS Regression. The second approach was introduced as PLS by Bookstein (cite Book and McIntosh) and is sometimes called PLS Correlation (Anjali) or PLS-SVD. This approach can be traced back to Ledyard Tucker's Interbattery Factor Analysis. The third approach was introduced by Tenenhaus or Vinzo? and is called PLS Path Modelling, a PLS Regression approach to Path Modelling.

Software
The first is a regression approach (PLS Regression), introduced by the Swedish statistician Herman Wold, who then developed it with his son, Svante Wold. The second is a "correlation" approach, introduced by

that bears some relation to principal components regression; instead of finding hyperplanes of minimum variance between the response and independent variables, it finds a linear regression model by projecting the predicted variables and the observable variables to a new space. Because both the X and Y data are projected to new spaces, the PLS family of methods are known as bilinear factor models. Partial least squares Discriminant Analysis (PLS-DA) is a variant used when the Y is binary.

PLS is used to find the fundamental relations between two matrices (X and Y), i.e. a latent variable approach to modeling the covariance structures in these two spaces. A PLS model will try to find the multidimensional direction in the X space that explains the maximum multidimensional variance direction in the Y space. PLS regression is particularly suited when the matrix of predictors has more variables than observations, and when there is multicollinearity among X values. By contrast, standard regression will fail in these cases.

The PLS algorithm is employed in PLS path modelling, a method of modeling a "causal" network of latent variables, as the word 'causal' has to put in quotes because causes obviously cannot be determined without experimental or quasi-experimental methods. This technique is a form of structural equation modeling, distinguished from the classical method by being component-based rather than covariance-based.

Partial least squares was introduced by the Swedish statistician Herman Wold, who then developed it with his son, Svante Wold. An alternative term for PLS (and more correct according to Svante Wold ) is projection to latent structures, but the term partial least squares is still dominant in many areas. Although the original applications were in the social sciences, PLS regression is today most widely used in chemometrics and related areas. It is also used in bioinformatics, sensometrics, neuroscience and anthropology. In contrast, PLS path modeling is most often used in social sciences, econometrics, marketing and strategic management.

Underlying model
The general underlying model of multivariate PLS is


 * $$\begin{align}

X &= T P^{\top} + E\\ Y &= U Q^{\top} + F, \end{align}$$

where $$X$$ is an $$n \times m$$ matrix of predictors, $$Y$$ is an $$n \times p$$ matrix of responses; $$T$$ and $$U$$ are $$n \times l$$ matrices that are, respectively, projections of X (the X score, component or factor matrix) and projections of Y (the Y scores); $$P$$ and $$Q$$ are, respectively, $$m \times l$$ and $$p \times l$$ orthogonal loading matrices; and matrices $$E$$ and $$F$$ are the error terms, assumed to be independent and identically distributed random normal variables. The decompositions of X and Y are made so as to maximise the covariance of T and U.

Algorithms
A number of variants of PLS exist for estimating the factor and loading matrices $$T, P$$ and $$Q$$. Most of them construct estimates of the linear regression between $$X$$ and $$Y$$ as $$Y = X \tilde{B} + \tilde{B}_0$$. Some PLS algorithms are only appropriate for the case where $$Y$$ is a column vector, while others deal with the general case of a matrix $$Y$$. Algorithms also differ on whether they estimate the factor matrix $$T$$ as an orthogonal, an orthonormal matrix or not. The final prediction will be the same for all these varieties of PLS, but the components will differ.

PLS1
PLS1 is a widely used algorithm appropriate for the vector $$Y$$ case. It estimates $$T$$ as an orthonormal matrix. In pseudocode it is expressed below (capital letters are matrices, lower case letters are vectors if they are superscripted and scalars if they are subscripted):

1 function PLS1($$X, y, l$$) 2 $$X^{(0)} \gets X$$ 3 $$w^{(0)} \gets X^T y/||X^Ty||$$, an initial estimate of $$w$$. 4 $$t^{(0)} \gets X w^{(0)}$$ 5 for $$k$$ = 0 to $$l$$ 6     $$t_k \gets {t^{(k)}}^T t^{(k)}$$ (note this is a scalar) 7     $$t^{(k)} \gets t^{(k)} / t_k$$ 8     $$p^{(k)} \gets {X^{(k)}}^T t^{(k)}$$ 9     $$q_k \gets {y}^T t^{(k)}$$ (note this is a scalar) 10     if $$q_k$$ = 0 11         $$l \gets k$$, break the for loop 12     if $$k < l$$ 13         $$X^{(k+1)} \gets X^{(k)} - t_k t^{(k)} {p^{(k)}}^T$$ 14         $$w^{(k+1)} \gets {X^{(k+1)}}^T y $$ 15         $$t^{(k+1)} \gets X^{(k+1)}w^{(k+1)}$$ 16 end for 17 define $$W$$ to be the matrix with columns $$w^{(0)},w^{(1)},...,w^{(l-1)}$$. Do the same to form the $$P$$ matrix and $$q$$ vector. 18 $$B \gets W {(P^T W)}^{-1} q$$ 19 $$B_0 \gets q_0 - {P^{(0)}}^T B$$ 20 return $$B, B_0$$

This form of the algorithm does not require centering of the input $$X$$ and $$Y$$, as this is performed implicitly by the algorithm. This algorithm features 'deflation' of the matrix $$X$$ (subtraction of $$t_k t^{(k)} {p^{(k)}}^T$$), but deflation of the vector $$y$$ is not performed, as it is not necessary (it can be proved that deflating $$y$$ yields the same results as not deflating.). The user-supplied variable $$l$$ is the limit on the number of latent factors in the regression; if it equals the rank of the matrix $$X$$, the algorithm will yield the least squares regression estimates for $$B$$ and $$B_0$$

Extensions
In 2002 a new method was published called orthogonal projections to latent structures (OPLS). In OPLS, continuous variable data is separated into predictive and uncorrelated information. This leads to improved diagnostics, as well as more easily interpreted visualization. However, these changes only improve the interpretability, not the predictivity, of the PLS models. L-PLS extends PLS regression to 3 connected data blocks. Similarly, OPLS-DA (Discriminant Analysis) may be applied when working with discrete variables, as in classification and biomarker studies.

Software implementation
Most major statistical software packages offer PLS regression.