mvr.mvrCv(X, Y, ncomp, Y.add = NULL, weights = NULL,
method = pls.options()$mvralg, scale = FALSE,
segments = 10, segment.type = c("random", "consecutive", "interleaved"),
length.seg, jackknife = FALSE, trace = FALSE, ...)NAs and Infs are not
allowed.NAs and Infs
are not allowed.cppls.cppls. (Optional)TRUE, the learning $X$ data for each
segment is scaled by dividing each variable by its sample standard
deviation. The prediction data is scaled by the same amount.segments is a list.segments unless
segments is a list.TRUE, the segment number is printed
for each segment."CV" for cross-validation.jackknife is TRUE) an array
with the jackknifed regression coefficients. The dimensions
correspond to the predictors, responses, number of components, and
segments, respectively.ncomp components. Each row corresponds to one response variable.MSEP uses this.cppls is used, gamma values for the
powers of each CV segment are returned.pcr, plsr, cppls
or mvr with the argument validation set to "CV" or
"LOO". All arguments to mvrCv can be specified in the
generic function call. If segments is a list, the arguments segment.type and
length.seg are ignored. The elements of the list should be
integer vectors specifying the indices of the segments. See
cvsegments for details.
Otherwise, segments of type segment.type are generated. How
many segments to generate is selected by specifying the number of
segments in segments, or giving the segment length in
length.seg. If both are specified, segments is
ignored.
If jackknife is TRUE, jackknifed regression coefficients
are returned, which can be used for for variance estimation
(var.jack) or hypothesis testing (jack.test).
X and Y do not need to be centered.
Note that this function cannot be used in situations where $X$
needs to be recalculated for each segment (except for scaling by the
standard deviation), for instance with
msc or other preprocessing. For such models, use the more
general (but slower) function crossval.
Also note that if needed, the function will silently(!) reduce
ncomp to the maximal number of components that can be
cross-validated, which is $n - l - 1$, where $n$ is the
number of observations and $l$ is the length of the longest
segment. The (possibly reduced) number of components is returned as
the component ncomp.
By default, the cross-validation will be performed serially. However,
it can be done in parallel using functionality in the
parallel package by setting the option parallel in
pls.options. See pls.options for the
different ways to specify the parallelism.
mvr
crossval
cvsegments
MSEP
var.jack
jack.testdata(yarn)
yarn.pcr <- pcr(density ~ NIR, 6, data = yarn, validation = "CV", segments = 10)
plot(MSEP(yarn.pcr))Run the code above in your browser using DataLab