mvrCv                  package:pls                  R Documentation

_C_r_o_s_s-_v_a_l_i_d_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Performs the cross-validation calculations for 'mvr'.

_U_s_a_g_e:

     mvrCv(X, Y, ncomp,
           method = c("kernelpls", "simpls", "oscorespls", "svdpc"),
           segments = 10, segment.type = c("random", "consecutive", "interleaved"),
           length.seg, trace = FALSE, ...)

_A_r_g_u_m_e_n_t_s:

       X: a matrix of observations.  'NA's and 'Inf's are not allowed.

       Y: a vector or matrix of responses.  'NA's and 'Inf's are not
          allowed.

   ncomp: the number of components to be used in the modelling.

  method: the multivariate regression method to be used.

segments: the number of segments to use, or a list with segments (see
          below).

segment.type: the type of segments to use.  Ignored if 'segments' is a
          list.

length.seg: Positive integer.  The length of the segments to use.  If
          specified, it overrides 'segments'.

   trace: logical; if 'TRUE', the segment number is printed for each
          segment.

     ...: additional arguments, sent to the underlying fit function.

_D_e_t_a_i_l_s:

     This function is not meant to be called directly, but through the
     generic functions 'pcr', 'plsr' or 'mvr' with the argument 'CV =
     TRUE'.  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, for instance with 'msc' or
     other preprocessing.  For such models, use the more general (but
     slower) function 'crossval'.

_V_a_l_u_e:

     A list with the following components: 

  method: euqals '"CV"' for cross-validation.

    pred: an array with the cross-validated predictions.

   MSEP0: a vector of MSEP values (one for each response variable) for
          a model with zero components, i.e., only the intercept.

    MSEP: a matrix of MSEP values for models with 1, ..., 'ncomp'
          components.  Each row corresponds to one response variable.

     adj: a matrix of adjustment values for calculating bias corrected
          MSEP.  'MSEP' uses this.

      R2: a matrix of R2 values for models with 1, ..., 'ncomp'
          components.  Each row corresponds to one response variable.

segments: the list of segments used in the cross-validation.

_N_o_t_e:

     The 'MSEP0' is always cross-validated using leave-one-out
     cross-validation.  This usually makes little difference in
     practice, but should be fixed for correctness.

_A_u_t_h_o_r(_s):

     Ron Wehrens and Bjrn-Helge Mevik

_R_e_f_e_r_e_n_c_e_s:

     Mevik, B.-H., Cederkvist, H. R. (2004) Mean Squared Error of
     Prediction (MSEP) Estimates for Principal Component Regression
     (PCR) and Partial Least Squares Regression (PLSR). _Journal of
     Chemometrics_, *18*(9), 422-429.

_S_e_e _A_l_s_o:

     'mvr' 'crossval' 'cvsegments' 'MSEP'

_E_x_a_m_p_l_e_s:

     data(NIR)
     NIR.pcr <- pcr(y ~ X, 6, data = NIR, CV = TRUE, segments = 10)
     ## Not run: plot(MSEP(NIR.pcr))

