lsplsCv {lspls} | R Documentation |
Cross-Validate LS-PLS Models
Description
Calculate cross-validated predictions for LS-PLS models.
Usage
lsplsCv(formula, ncomp, data, subset, na.action, segments = 10,
segment.type = c("random", "consecutive", "interleaved"),
length.seg, model = TRUE, ...)
Arguments
formula |
model formula. See Details. |
ncomp |
list or vector of positive integers, giving the number of components to use for each PLS matrix. See Details. |
data |
an optional data frame with the data to fit the model from. |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
a function which indicates what should happen when the data contain missing values. |
segments |
the number of segments to use, or a list with segments (see Details). |
segment.type |
the type of segments to use. Ignored if
|
length.seg |
Positive integer. The length of the segments to
use. If specified, it overrides |
model |
logical. If |
... |
additional arguments, passed to the underlying
cross-validation function (currently |
Details
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.
Value
An object of class "lsplsCv"
, with components
pred |
the cross-validated predictions. An array with one dimension for the observations, one for the responses, and one for each of the PLS matrices. |
segments |
the list of segments used in the cross-validation. |
na.action |
if observations with missing values were removed,
|
ncomp |
the list of number of components used in the model. |
call |
the function call. |
terms |
the model terms. |
model |
if |
Note
Currently, lsplsCv
handles the formula and the data, and calls
orthlsplsCv
for the actual cross-validation. The
formula interface is experimental, and might change in future versions.
Author(s)
Bjørn-Helge Mevik
References
Jørgensen, K., Segtnan, V. H., Thyholt, K., Næ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ørgensen, K., Mevik, B.-H., Næs, T. Combining Designed Experiments with Several Blocks of Spectroscopic Data. (Submitted)
Mevik, B.-H., Jørgensen, K., Måge, I., Næs, T. LS-PLS: Combining Categorical Design Variables with Blocks of Spectroscopic Measurements. (Submitted)
See Also
lspls
, plot.lsplsCv
,
cvsegments
, orthlsplsCv
,
lspls-package
Examples
##FIXME