koplsCV                package:kopls                R Documentation

_K-_O_P_L_S _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:

     Function for performing K-OPLS cross-validation for a set of
     'Y'-orthogonal components. The function returns a number of
     diagnostic parameters which can be used to determine the optimal
     number of model components.

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

     koplsCV(K, Y, A, oax, nrcv = 7, cvType = "nfold", preProcK = "mc", preProcY = "mc", cvFrac = 0.75, modelType = "re")

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

       K: The kernel matrix (un-centered); see 'koplsKernel' for
          details. 

       Y: The response matrix (un-centered/scaled). Could be binary
          (for discriminant analysis) or real-valued. 

       A: The number of 'Y'-predictive components (integer). 

     oax: The number of 'Y'-orthogonal components (integer). 

    nrcv: Number of cross-validation rounds (integer).

  cvType: Type of cross-validation. Either 'nfold' for n-fold
          cross-validation, 'mccv' for Monte Carlo CV or 'mccvb' for
          Monte Carlo class-balanced CV. See also 'koplsCrossValSet'
          for details. 

preProcK: Pre-processing settings for the kernel matrix. Either 'mc'
          for mean-centering or 'no' for no pre-processing. 

preProcY: Pre-processing parameter for 'Y'. Either 'mc' for
          mean-centering, 'uv' for mc + scaling to unit-variance,
          'pareto' for mc + Pareto-scaling or 'no' for no scaling.

  cvFrac: Fraction of observations in the training set during
          cross-validation. Only applicable for 'mccv' or 'mccvb'
          cross-validation (see 'cvType')

modelType: 'da' for discriminant analysis, 're' for regression. If
          'da', sensitivity and specificity will be calculated.

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

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

koplsModel: K-OPLS model object with 'A' predictive components and
          'oax' 'Y'-orthogonal components.

      cv: Cross-validation results:

     _Q_2_Y_h_a_t Total Q-square result for all 'Y'-orthogonal components. 

     _Q_2_Y_h_a_t_V_a_r_s Q-square result per 'Y'-variable for all 'Y'-orthogonal
          components.

     _Y_h_a_t All predicted 'Y' values as a concatenated matrix.

     _T_c_v Predictive score vector T for all cross-validation rounds.

     _c_v_T_r_a_i_n_I_n_d_e_x Indices for the training set observations during the
          cross-validation rounds.

     _c_v_T_e_s_t_I_n_d_e_x Indices for the test set observations during the
          cross-validation rounds.

      da: Cross-validation results specifically for discriminant
          analysis case:

     _p_r_e_d_C_l_a_s_s Predicted class list per class and 'Y'-orthogonal
          components (integer values).

     _t_r_u_e_C_l_a_s_s Predicted class list per class and 'Y'-orthogonal
          components (integer values).

     _s_e_n_s_S_p_e_c Sensitivity and specificity values per class and
          'Y'-orthogonal components (integer values).

     _c_o_n_f_u_s_i_o_n_M_a_t_r_i_x Confusion matrix during cross-validation rounds.

     _n_c_l_a_s_s_e_s Number of classes in model.

     _d_e_c_i_s_i_o_n_R_u_l_e Decision rule used: 'max' or 'fixed'. 

    args: Arguments to the function:

     _A See 'A'.

     _o_a_x See 'oax'. 

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

     Max Bylesjo and Mattias Rantalainen

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

     Rantalainen M, Bylesjo M, Cloarec O, Nicholson JK, Holmes E and
     Trygg J. *Kernel-based orthogonal projections to latent structures
     (K-OPLS)*, _J Chemometrics_ 2007; 21:376-385.
     doi:10.1002/cem.1071.

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

     ## Load data set
     data(koplsExample)

     ## Define kernel function parameter
     sigma<-25 

     ## Construct kernel
     Ktr<-koplsKernel(Xtr,NULL,'g',sigma)

     ## Find optimal number of Y-orthogonal components by cross-validation
     ## The cross-validation tests models with Y-orthogonal components 0 through numYo
     modelCV<-koplsCV(Ktr,Ytr,1,3,nrcv=7,cvType='nfold',preProcK='mc',preProcY='mc',modelType='da')

     ## Visualize results
     koplsPlotCVDiagnostics(modelCV)
     title("Statistics from K-OPLS cross-validation of original data")

