| mvr {pls.pcr} | R Documentation |
Generic function for multivariate regression. PCR and two
types of PLS (SIMPLS and kernel-PLS) are implemented. The functions
pcr and pls are simple wrappers for mvr.
Cross-validation can be used; a nmber of latent variables
to retain is suggested.
mvr(X, Y, ncomp,
method=c("PCR", "SIMPLS", "kernelPLS"),
validation=c("none","CV"), grpsize, niter)
pcr(...)
pls(..., method)
X |
a matrix of observations. NAs and Infs are not
allowed. |
Y |
a vector or matrix of responses. NAs and Infs
are not allowed. |
ncomp |
the numbers of latent variables to be assessed in the
modelling. Default is from one to the rank of X. |
method |
the multivariate regression method to be used. |
validation |
validation method, either "none" or cross-validation ("CV"). |
grpsize |
the group size for the "CV" validation. If not
specified, this is determined by the niter parameter. |
niter |
the number of iterations in the
cross-validation. Default: 10. If both niter and
grpsize are specified, niter takes precedence. |
... |
arguments for mvr. |
An object of class mvr is returned. This has the following
components:
nobj |
the number of objects, viz. the number of rows in X and Y. |
nvar |
the number of independent variables, viz. the number of columns in X. |
npred |
the number of Y variables. |
Xmeans |
column means of original X data matrix. |
Y |
original Y data. Y is represented as a matrix, possibly with only one column. |
ncomp |
the number of latent variables considered in the PCR regression. |
method |
the regression method used. |
training |
a list with the following components:
ncomp. The dimensions of B are
c(nvar, npred, length(ncomp)) with nvar the number
of X variables and npred the number of variables to be
predicted in Y.
ncomp. |
validat |
a list with the following components:
ncomp. |
pcr.model, simpls,
kernelpls, plot.mvr,
summary.mvr
data(NIR) attach(NIR) NIR.pcr <- mvr(Xtrain, Ytrain, 1:6, validation="CV") NIR.simpls <- mvr(Xtrain, Ytrain, 1:6, validation="CV", method="SIMPLS") NIR.kernelpls <- mvr(Xtrain, Ytrain, 1:6, validation="CV", method="kernelPLS") data(sensory) Pn <- scale(sensory$Panel) Ql <- scale(sensory$Quality) sens.pcr <- mvr(Ql, Pn, 1:5) sens.simpls <- mvr(Ql, Pn, 1:5, method="SIMPLS") sens.kernelpls <- mvr(Ql, Pn, 1:5, method="kernelPLS")