| grocCrossval | R Documentation |
A “stand alone” cross-validation function for groc objects.
grocCrossval(object, segments = 10, segment.type = c("random",
"consecutive","interleaved"), length.seg, trace = 15, ...)
object |
a |
segments |
the number of segments to use, or a list with segments (see below). |
segment.type |
the type of segments to use. |
length.seg |
Positive integer. The length of the segments to use. |
trace |
if |
... |
additional arguments, sent to the underlying fit function. |
This function performs cross-validation on a model fit by groc.
It can handle models such as groc(Y ~ X, ...).
Note that to use grocCrossval, the data must be specified
with a data argument when fitting object.
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.
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.
When tracing is turned on, the segment number is printed for each segment.
The supplied object is returned, with an additional component
validation, which is a list with components
method |
equals |
pred |
an array with the cross-validated predictions. |
PRESS |
a matrix of PRESS values for models with 1, ...,
|
PREMAD |
a matrix of PREMAD values for models with 1, ...,
|
RMSEP |
a matrix of sqrt(PRESS/nobj) values for models with 1, ...,
|
segments |
the list of segments used in the cross-validation. |
ncomp |
the number of components. |
Martin Bilodeau (bilodeau@dms.umontreal.ca) and Pierre Lafaye de Micheaux (lafaye@unsw.edu.au)
Martin Bilodeau, Pierre Lafaye de Micheaux, Smail Mahdi (2015), The R
Package groc for Generalized Regression on Orthogonal Components,
Journal of Statistical Software, 65(1), 1-29,
https://www.jstatsoft.org/v65/i01/
data(yarn,package="pls")
yarn.groc <- groc(density ~ NIR, 6, data = yarn)
yarn.cv <- grocCrossval(yarn.groc, segments = 10)
yarn.cv$validation$PRESS
yarn.cv$validation$PREMAD
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.