mvr                   package:pls                   R Documentation

_P_a_r_t_i_a_l _L_e_a_s_t _S_q_u_a_r_e_s _a_n_d _P_r_i_n_c_i_p_a_l _C_o_m_p_o_n_e_n_t_s _R_e_g_r_e_s_s_i_o_n

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

     Functions to perform partial least squares regression (PLSR) or
     principal components regression (PCR), with a formula interface.
     Cross-validation can be used.  Prediction, model extraction, plot,
     print and summary methods exist.

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

     mvr(formula, ncomp, data, subset, na.action,
         method = c("kernelpls", "simpls", "oscorespls", "svdpc"),
         validation = c("none", "CV", "LOO"),
         model = TRUE, x = FALSE, y = FALSE, ...)
     plsr(..., method = c("kernelpls", "simpls", "oscorespls"))
     pcr(..., method = "svdpc")

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

 formula: a model formula.  Most of the 'lm' formula constructs are
          supported.

   ncomp: the number of components to include in the model (see below).

    data: an optional data frame with the data to fit the model from.

  subset: an optional vector specifying a subset of observations to be
          used in the fitting process.

na.action: a function which indicates what should happen when the data
          contain missing values.

  method: the multivariate regression method to be used.

validation: character.  What kind of (internal) validation to use.  See
          below.

   model: a logical.  If 'TRUE', the model frame is returned.

       x: a logical.  If 'TRUE', the model matrix is returned.

       y: a logical.  If 'TRUE', the response is returned.

     ...: additional arguments, passed to the underlying fit functions,
          and 'mvrCv'.

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

     The functions fit PLSR or PCR models with 1, ..., 'ncomp' number
     of components.  Multi-response models are fully supported.

     Three PLSR algorithms are available: the kernel algorithm, SIMPLS
     and the classical orthogonal scores algorithm.  One PCR algorithm
     is available: using the singular value decomposition.  The type of
     regression is specified with the 'method' argument.  'pcr' and
     'plsr' are wrappers for 'mvr', with different values for 'method'.

     If 'validation = "CV"', cross-validation is performed.  The number
     and type of cross-validation segments are specified with the
     arguments 'segments' and 'segment.type'.  See 'mvrCv' for details.
      If 'validation = "LOO"', leave-one-out cross-validation is
     performed.  It is an error to specify the segments when
     'validation = "LOO"' is specified.

     Note that the cross-validation is optimised for speed, and some
     generality has been sacrificed.  Especially, the model matrix is
     calculated only once for the complete cross-validation, so models
     like 'y ~ msc(X)' will not be properly cross-validated.  For
     proper cross-validation of models where the model matrix must be
     updated/regenerated for each segment, use the separate function
     'crossval'.

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

     'mvr' returns an object of class 'mvr'. The object contains all
     components returned by the underlying fit function.  In addition,
     it contains the following components: 

validation: if validation was requested, the results of the
          cross-validation.  See 'mvrCv' for details.

   ncomp: the number of components of the model.

  method: the method used to fit the model.  See the argument 'method'
          for possible values.

    call: the function call.

   terms: the model terms.

   model: if 'model = TRUE', the model frame.

       x: if 'x = TRUE', the model matrix.

       y: if 'y = TRUE', the model response.

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

     Ron Wehrens and Bjrn-Helge Mevik

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

     Martens, H., Ns, T. (1989) _Multivariate calibration._
     Chichester: Wiley.

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

     'kernelpls.fit', 'simpls.fit', 'oscorespls.fit', 'svdpc.fit',
     'mvrCv', 'loadings', 'scores', 'loading.weights', 'coef.mvr',
     'predict.mvr', 'R2', 'MSEP', 'RMSEP'

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

     data(NIR)
     ## Default methods:
     NIR.pcr <- pcr(y ~ X, 6, data = NIR, CV = TRUE)
     NIR.pls <- plsr(y ~ X, 6, data = NIR, CV = TRUE)

     ## Alternative methods:
     NIR.oscorespls <- mvr(y ~ X, 6, data = NIR, CV = TRUE,
                           method = "oscorespls")
     NIR.simpls <- mvr(y ~ X, 6, data = NIR, CV = TRUE,
                       method = "simpls")

     data(sensory)
     Pn <- scale(sensory$Panel)
     Ql <- scale(sensory$Quality)
     sens.pcr <- pcr(Ql ~ Pn, ncomp = 4)
     sens.pls <- plsr(Ql ~ Pn, ncomp = 4)

