pls_kernel | R Documentation |

PLS1 and PLS2 algorithms.

`pls_kernel`

implements the "improved kernel algorithm #1" proposed by Dayal and MacGregor (1997). This algorithm is stable and fast (Andersson 2009), and returns the same results as NIPALS.

`pls_nipals`

implements the NIPALS algorithm (e.g. Tenenhaus 1998, Wold 2002). For PLS2, note that the usual NIPALS iterative part is replaced by the direct calculation of the weights vector `w`

by SVD decomposition of matrix `X'Y`

(Hoskuldsson 1988 p.213).

`pls_rannar`

implements a kernel algorithm proposed by Rannar et al. (1994) for "wide" matrices, i.e. with low number of rows and very large number of columns (p >> n; e.g. p = 20000). In such a situation, this algorithm is faster than the others (but becomes much slower in other situations). If the algorithm converges, it returns the same results as NIPALS (Note: discrepancies can be observed if too many PLS components are requested compared to the low number of observations).

The functions can give a priori weights to the observations (rows of `X`

), with argument `weights`

. This modifies the importance given to each of the `n`

observations in the calculations of the scores, loadings and predictions.

Matrix `X`

is centered before the analyses, but `X`

is not column-wise scaled (there is no argument `scale`

available). If a scaling is needed, the user has to scale `X`

before using the functions.

```
pls_kernel(X, Y, ncomp, weights = NULL)
pls_nipals(X, Y, ncomp, weights = NULL)
pls_rannar(X, Y, ncomp, weights = NULL)
```

`X` |
A |

`Y` |
A |

`ncomp` |
The maximal number of scores (i.e. components = latent variables) to be calculated. |

`weights` |
A vector of length |

A list of outputs, such as:

`T` |
The X-score matrix ( |

`P` |
The X-loadings matrix ( |

`W` |
The X-loading weights matrix ( |

`C` |
The Y-loading weights matrix (C = t(Beta), where Beta is the scores regression coefficients matrix). |

`R` |
The PLS projection matrix ( |

`xmeans` |
The centering vector of |

`ymeans` |
The centering vector of |

Andersson, M., 2009. A comparison of nine PLS1 algorithms. Journal of Chemometrics 23, 518-529.

Dayal, B.S., MacGregor, J.F., 1997. Improved PLS algorithms. Journal of Chemometrics 11, 73-85.

Hoskuldsson, A., 1988. PLS regression methods. Journal of Chemometrics 2, 211-228. https://doi.org/10.1002/cem.1180020306

Kim, S., Kano, M., Nakagawa, H., Hasebe, S., 2011. Estimation of active pharmaceutical ingredients content using locally weighted partial least squares and statistical wavelength selection. Int. J. Pharm., 421, 269-274.

Lesnoff, M., Metz, M., Roger, J.M., 2020. Comparison of locally weighted PLS strategies for regression and discrimination on agronomic NIR Data. Journal of Chemometrics. e3209. https://onlinelibrary.wiley.com/doi/abs/10.1002/cem.3209

Rannar, S., Lindgren, F., Geladi, P., Wold, S., 1994. A PLS kernel algorithm for data sets with many variables and fewer objects. Part 1: Theory and algorithm. Journal of Chemometrics 8, 111-125. https://doi.org/10.1002/cem.1180080204

Schaal, S., Atkeson, C., Vijayamakumar, S. 2002. Scalable techniques from nonparametric statistics for the real time robot learning. Applied Intell., 17, 49-60.

Sicard, E. Sabatier, R., 2006. Theoretical framework for local PLS1 regression and application to a rainfall data set. Comput. Stat. Data Anal., 51, 1393-1410.

Tenenhaus, M., 1998. La rÃ©gression PLS: thÃ©orie et pratique. Editions Technip, Paris, France.

Wold, S., Sjostrom, M., Eriksson, l., 2001. PLS-regression: a basic tool for chemometrics. Chem. Int. Lab. Syst., 58, 109-130.

```
n <- 8
p <- 6
set.seed(1)
X <- matrix(rnorm(n * p, mean = 10), ncol = p, byrow = TRUE)
y1 <- 100 * rnorm(n)
y2 <- 100 * rnorm(n)
Y <- cbind(y1, y2)
set.seed(NULL)
pls_kernel(X, y1, ncomp = 3)
pls_kernel(X, Y, ncomp = 3)
pls_kernel(X, Y, ncomp = 3)$T
pls_kernel(X, Y, ncomp = 3, weights = 1:n)$T
pls_nipals(X, Y, ncomp = 3, weights = 1:n)$T
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.