Calculate cross-validated predictions for LS-PLS models.
lsplsCv(formula, ncomp, data, subset, na.action, segments = 10,
segment.type = c("random", "consecutive", "interleaved"),
length.seg, model = TRUE, …)
model formula. See Details.
list or vector of positive integers, giving the number of components to use for each PLS matrix. See Details.
an optional data frame with the data to fit the model from.
an optional vector specifying a subset of observations to be used in the fitting process.
a function which indicates what should happen when the data contain missing values.
the number of segments to use, or a list with segments (see Details).
the type of segments to use. Ignored if
segments
is a list.
Positive integer. The length of the segments to
use. If specified, it overrides segments
unless
segments
is a list.
logical. If TRUE
, the model frame is returned.
additional arguments, passed to the underlying
cross-validation function (currently orthlsplsCv
).
An object of class "lsplsCv"
, with components
the cross-validated predictions. An array with one dimension for the observations, one for the responses, and one for each of the PLS matrices.
the list of segments used in the cross-validation.
if observations with missing values were removed,
na.action
contains a vector with their indices.
the list of number of components used in the model.
the function call.
the model terms.
if model = TRUE
, the model frame.
The function performs a cross-validation, using the model and segments
specified in the call. It returns an object of class
"lsplsCv"
, which has a plot method (see
plot.lsplsCv
). See lspls-package for typical
usage and more about LS-PLS models.
See lspls
for details about specifying the model
with formula
and ncomp
. Note that lsplsCv
cross-validates models with from 0 components to the numbers of
components specified with ncomp
.
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.
J<U+00F8>rgensen, K., Segtnan, V. H., Thyholt, K., N<U+00E6>s, T. (2004) A Comparison of Methods for Analysing Regression Models with Both Spectral and Designed Variables. Journal of Chemometrics, 18(10), 451--464.
J<U+00F8>rgensen, K., Mevik, B.-H., N<U+00E6>s, T. Combining Designed Experiments with Several Blocks of Spectroscopic Data. (Submitted)
Mevik, B.-H., J<U+00F8>rgensen, K., M<U+00E5>ge, I., N<U+00E6>s, T. LS-PLS: Combining Categorical Design Variables with Blocks of Spectroscopic Measurements. (Submitted)