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