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

View source: R/T2.R

T2_plsR Documentation

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, as the T^2 calculations done by mult.chart.

Usage

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

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.

Value

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

References

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

Examples

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')
}

plsVarSel documentation built on Jan. 12, 2023, 5:09 p.m.