koplsPredict              package:kopls              R Documentation

_P_r_e_d_i_c_t_i_o_n _o_f _n_e_w _s_a_m_p_l_e_s _f_r_o_m _a _K-_O_P_L_S _m_o_d_e_l

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

     Performs prediction of new samples from an existing K-OPLS model
     (see 'koplsModel'). The function projects the Y-predictive and
     Y-orthogonal scores components to predict a value of the response
     matrix Y. The dimensionality of the parameters is determined from
     'model'.

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

     koplsPredict(KteTr, Ktest, Ktrain, model, nox = NA, rescaleY = FALSE)

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

   KteTr: The hybrid test/training kernel matrix; KteTr =
          <phi(Xte),phi(Xtr)>.

   Ktest: The test kernel matrix; Ktest = <phi(Xte),phi(Xte)>.

  Ktrain: The training kernel matrix (same as used in model training);
          Ktrain = <phi(Xtr),phi(Xtr)>

   model: The trained K-OPLS model (see 'koplsModel' ).

     nox: Number of Y-orthogonal score vectors. If undefined, the value
          used in 'model' will be employed.

rescaleY: If true, the estimated Yhat values will be rescaled according
          to the scaling parameters in 'model'. Otherwise Yhat values
          will be returned as is (default).

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

      Tp: Predicted predictive score matrix for all generations 0:'nox'
          of Y-orthogonal vectors.

       T: Predictive score matrix for the final model with 'nox'
          Y-orthogonal vectors.

      to: Predicted Y-orthogonal score vectors.

 EEprime: Calculated residuals for the test kernel matrix 'Ktest',
          useful e.g. for residual statistics.

    Yhat: Predicted values of the response matrix.

_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

     ## Define number of Y-orthogonal components
     nox<-3

     ## Construct kernels
     Ktr<-koplsKernel(Xtr,NULL,'g',sigma)
     KteTr<-koplsKernel(Xte,Xtr,'g',sigma)
     KteTe<-koplsKernel(Xte,NULL,'g',sigma)

     ## Model 
     model<-koplsModel(Ktr,Ytr,1,nox,'mc','mc');

     ## Predict
     modelPred<-koplsPredict(KteTr,KteTe,Ktr,model,rescaleY=TRUE)

     ## Visualize
     plot(modelPred$Yhat, Yte, xlab="Predicted", ylab="Observed")
     abline(v=0.5, col="Red", lty=2) ## Approximate decision boundary

