LDA/QDA classification from PLS model

Share:

Description

For each number of components LDA/QDA models are created from the scores of the supplied PLS model and classifications are performed.

Usage

1
lda_from_pls(model, grouping, newdata, ncomp)

Arguments

model

pls model fitted with the pls package

grouping

vector of grouping labels

newdata

predictors in the same format as in the pls model

ncomp

maximum number of PLS components

Value

matrix of classifications

See Also

VIP (SR/sMC/LW/RC), filterPLSR, shaving, stpls, truncation, bve_pls, ga_pls, ipw_pls, mcuve_pls, rep_pls, spa_pls, lda_from_pls, lda_from_pls_cv, setDA.

Examples

1
2
3
4
5
6
7
data(mayonnaise, package = "pls")
mayonnaise <- within(mayonnaise, {dummy <- model.matrix(~y-1,data.frame(y=factor(oil.type)))})
pls <- plsr(dummy ~ NIR, ncomp = 10, data = mayonnaise, subset = train)
with(mayonnaise, {
 classes <- lda_from_pls(pls, oil.type[train], NIR[!train,], 10)
 colSums(oil.type[!train] == classes) # Number of correctly classified out of 42
})