Learn R Programming

plsVarSel (version 0.9.12)

T2_pls: Hotelling's T^2 based variable selection in PLS -- T^2-PLS)

Description

Variable selection based on the T^2 statistic. A side effect of running the selection is printing of tables and production of plots.

Usage

T2_pls(ytr, Xtr, yts, Xts, ncomp = 10, alpha = c(0.2, 0.15, 0.1, 0.05, 0.01))

Value

Parameters and variables corresponding to variable selections of minimum error and minimum variable set.

Arguments

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.

References

Tahir Mehmood, Hotelling T^2 based variable selection in partial least squares regression, Chemometrics and Intelligent Laboratory Systems 154 (2016), pp 23-28

Examples

Run this code
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')
}

Run the code above in your browser using DataLab