T2_pls | R Documentation |
Variable selection based on the T^2 statistic. A side effect of running the selection is printing of tables and production of plots.
T2_pls(ytr, Xtr, yts, Xts, ncomp = 10, alpha = c(0.2, 0.15, 0.1, 0.05, 0.01))
ytr |
Vector of responses for model training. |
Xtr |
Matrix of predictors for model training. |
yts |
Vector of responses for model testing. |
Xts |
Matrix of predictors for model testing. |
ncomp |
Number of PLS components. |
alpha |
Hotelling's T^2 significance levels. |
Parameters and variables corresponding to variable selections of minimum error and minimum variable set.
Tahir Mehmood, Hotelling T^2 based variable selection in partial least squares regression, Chemometrics and Intelligent Laboratory Systems 154 (2016), pp 23-28
data(gasoline, package = "pls")
library(pls)
if(interactive()){
t2 <- T2_pls(gasoline$octane[1:40], gasoline$NIR[1:40,],
gasoline$octane[-(1:40)], gasoline$NIR[-(1:40),],
ncomp = 10, alpha = c(0.2, 0.15, 0.1, 0.05, 0.01))
matplot(t(gasoline$NIR), type = 'l', col=1, ylab='intensity')
points(t2$mv[[1]], colMeans(gasoline$NIR)[t2$mv[[1]]], col=2, pch='x')
points(t2$mv[[2]], colMeans(gasoline$NIR)[t2$mv[[2]]], col=3, pch='o')
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.