lda_from_pls_cv {plsVarSel} | R Documentation |
Cross-validated LDA/QDA classification from PLS model
Description
For each number of components LDA/QDA models are created from the scores of the supplied PLS model and classifications are performed. This use of cross-validation has limitations. Handle with care!
Usage
lda_from_pls_cv(model, X, y, ncomp, Y.add = NULL)
Arguments
model |
|
X |
predictors in the same format as in the |
y |
vector of grouping labels |
ncomp |
maximum number of PLS components |
Y.add |
additional responses |
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
data(mayonnaise, package = "pls")
mayonnaise <- within(mayonnaise, {dummy <- model.matrix(~y-1,data.frame(y=factor(oil.type)))})
pls <- plsr(dummy ~ NIR, ncomp = 8, data = mayonnaise, subset = train,
validation = "CV", segments = 40, segment.type = "consecutive")
with(mayonnaise, {
classes <- lda_from_pls_cv(pls, NIR[train,], oil.type[train], 8)
colSums(oil.type[train] == classes) # Number of correctly classified out of 120
})
[Package plsVarSel version 0.9.12 Index]