cvsegments            package:pls            R Documentation(latin1)

_G_e_n_e_r_a_t_e _s_e_g_m_e_n_t_s _f_o_r _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:

     The function generates a list of segments for cross-validation.
     Random, consecutive and interleaved segments can be produced.

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

     cvsegments(N, k, length.seg = ceiling(N/k),
                type = c("random", "consecutive", "interleaved"))

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

       N: Integer.  The number of objects in the data set.

       k: Integer.  The number of segments to return.

length.seg: Integer.  The length of the segments.  If given, it
          overrides 'k'.

    type: One of '"random"', '"consecutive"' and '"interleaved"'.  The
          type of segments to generate.  Default is '"random"'.

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

     If 'length.seg' is specified, it is used to calculate the number
     of segments to generate.  Otherwise 'k' must be specified.  If
     k*length.seg <> N, the k*length.seg - N last segments will contain
     only length.seg - 1 indices.

     If 'type' is '"random"', the indices are allocated to segments in
     random order.  If it is '"consecutive"', the first segment will
     contain the first length.seg indices, and so on. If 'type' is
     '"interleaved"', the first segment will contain the indices 1,
     length.seg+1, 2*lenght.seg+1, ..., (k-1)*length.seg+1, and so on.

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

     A list of vectors.  Each vector contains the indices for one
     segment. The attribute '"incomplete"' contains the number of
     incomplete segments, and the attribute '"type"' contains the type
     of segments.

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

     Bjrn-Helge Mevik and Ron Wehrens

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

     ## Segments for 10-fold randomised cross-validation:
     cvsegments(100, 10)

     ## Segments with four objects, taken consecutive:
     cvsegments(60, length.seg = 4, type = "cons")

     ## Incomplete segments
     segs <- cvsegments(50, length.seg = 3)
     attr(segs, "incomplete")

     ## Leave-one-out cross-validation:
     cvsegments(100, 100)
     ## Leave-one-out with variable/unknown data set size n:
     n <- 50
     cvsegments(n, length.seg = 1)

