mvr.mvrCv(X, Y, ncomp,
method = c("kernelpls", "simpls", "oscorespls", "svdpc"), scale = FALSE,
segments = 10, segment.type = c("random", "consecutive", "interleaved"),
length.seg, trace = FALSE, ...)"CV" for cross-validation.ncomp components. Each row corresponds to one response variable.MSEP uses this.ncomp components. Each row corresponds to one response variable.pcr, plsr or mvr with the
argument validation set to "CV" or "LOO". All
arguments to mvrCv can be specified in the generic function call. If length.seg is specified, segments of the requested length
are used. Otherwise:
If segments is a number, it specifies the number of segments to
use, and segment.type is used to select the type of segments.
If segments is a list, the elements of the list should be
integer vectors specifying the indices of the segments. See
cvsegments for details.
X and Y do not need to be centered.
The R2 component returned is calculated as the squared correlation
between the cross-validated predictions and the responses.
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.
mvr
crossval
cvsegments
MSEPdata(NIR)
NIR.pcr <- pcr(y ~ X, 6, data = NIR, validation = "CV", segments = 10)
plot(MSEP(NIR.pcr))Run the code above in your browser using DataLab