Performs cross validation with different PLS and/or discriminant analyses.
MVA.cv(X, Y, repet = 10, k = 7, ncomp = 8, scale = TRUE, model = c("PLSR",
"CPPLS", "PLS-DA", "PPLS-DA", "LDA", "QDA", "PLS-DA/LDA", "PLS-DA/QDA",
"PPLS-DA/LDA", "PPLS-DA/QDA"), lower = 0.5, upper = 0.5, Y.add = NULL,
weights = rep(1, nrow(X)), set.prior = FALSE, crit.DA = c("plug-in",
"predictive", "debiased"), ...)
model used.
type of model used.
number of times the whole procedure was repeated.
number of folds.
number of components used.
criterion used to classify individuals of the test sets.
levels of Y
if it is a factor.
list of of models generated (repet*k
models), for PLSR, CPPLS, PLS-DA, PPLS-DA, LDA and QDA.
list of of (P)PLS-DA models generated (repet*k
models), for PLS-DA/LDA, PLS-DA/QDA, PPLS-DA/LDA and PPLS-DA/QDA.
list of of LDA/QDA models generated (repet*k
models), for PLS-DA/LDA, PLS-DA/QDA, PPLS-DA/LDA and PPLS-DA/QDA.
RMSEP vales (repet
values).
Q2 values (repet
values).
Classification error rates (repet
values).
Confusion matrices (repet
values).
Probability of each individual of being of each level of Y
.
a data frame of independent variables.
the dependent variable(s): numeric vector, data frame of quantitative variables or factor.
an integer giving the number of times the whole procedure has to be repeated.
an integer giving the number of folds (can be re-set internally if needed).
an integer giving the number of components to be used for all models except LDA and QDA (can be re-set depending on the size of the train sets).
logical indicating if data should be scaled (see Details).
the model to be fitted (see Details).
a vector of lower limits for power optimisation in CPPLS or PPLS-DA (see cppls.fit
).
a vector of upper limits for power optimisation in CPPLS or PPLS-DA (see cppls.fit
).
a vector or matrix of additional responses containing relevant information about the observations, in CPPLS or PPLS-DA (see cppls.fit
).
a vector of individual weights for the observations, in CPPLS or PPLS-DA (see cppls.fit
).
only used when a LDA or QDA is performed (coupled or not with a PLS model). If TRUE
, the prior probabilities of class membership are defined according to the mean weight of individuals belonging to each class. If FALSE
, prior probabilities are obtained from the data sets on which LDA/QDA models are built.
criterion used to predict class membership when a LDA or QDA is used. See predict.lda
.
other arguments to pass to plsr
(PLSR, PLS-DA) or cppls
(CPPLS, PPLS-DA).
Maxime HERVE <maxime.herve@univ-rennes1.fr>
When a discriminant analysis is used ("PLS-DA"
, "PPLS-DA"
, "LDA"
, "QDA"
, "PLS-DA/LDA"
, "PLS-DA/QDA"
, "PPLS-DA/LDA"
or "PPLS-DA/QDA"
), the training sets are generated in respect to the relative proportions of the levels of Y
in the original data set (see splitf
).
"PLS-DA"
is considered as PLS2 on a dummy-coded response. For a PLS-DA based on the CPPLS algorithm, use "PPLS-DA"
with lower
and upper
limits of the power parameters set to 0.5
.
If scale = TRUE
, the scaling is done as this: for each step of the validation loop (i.e. k
steps), the training set is pre-processed by centering and unit-variance scaling. Means and standard deviations of variables in the training set are then used to scale the test set.
require(pls)
require(MASS)
# PLSR
data(yarn)
if (FALSE) MVA.cv(yarn$NIR,yarn$density,model="PLSR")
# PPLS-DA coupled to LDA
data(mayonnaise)
if (FALSE) MVA.cv(mayonnaise$NIR,factor(mayonnaise$oil.type),model="PPLS-DA/LDA")
Run the code above in your browser using DataLab