This question already has an answer here:
Assume we have a simple linear regression model expressed as $$y= X \beta + \epsilon,$$ where $y$ is a vector of size $n \times 1$, $X$ is a matrix of size $ n \times p$, $\beta$ is the regression coefficients vector of size $p\times 1$, and $\epsilon$ is a noise vector of size $n\times1$.
We all know that the Ordinary Least Squares (OLS) estimator of $\beta$ cannot be used when $p\gg n$. That is why there are a lot of alternative methods were proposed. One of these methods is the Partial Least Squares (PLS) estimator. I read some resources which explain the PLS, but unfortunately I didn't understand well the concept and the main difference between OLS and PLS.
So can someone kindly explain me in detail how PLS works?
Furthermore, can someone write me the Matlab code of how to estimate the $\beta$ vector using PLS?