mvr {pls.pcr}R Documentation

Multivariate Regression

Description

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.

Usage

mvr(X, Y, ncomp=1:min(nobj, nvar),
    method=c("PCR", "SIMPLS", "kernelPLS"),
    validation=c("none","CV"), grpsize, niter)
pcr(...)
pls(..., method)

Arguments

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.

Value

An object of class mvr is returned. This has the following components:

X 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 method used.
training a list with the following components:
B
an array of regression coefficients for all items in 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.
Ypred
predicted values for the training data.
RMS
Root-mean-square error of the training data for all items in ncomp.
R2
coefficient of multiple determination for the training data.
XvarExpl
Fraction of X-variance explained.
YvarExpl
Fraction of Y-variance explained (one column, even for multiple Y).
validat a list with the following components:
Ypred
predicted values.
nLV
number of latent variables suggested by cross-validation. The least complex model within one standard error of the best is chosen.
niter
the number of groups in the cross-validation. If this number equals the number of objects, this is leave-one-out validation.
RMS
Root-mean-square error from cross-validation for all items in ncomp.
RMS.sd
standard error of the root-mean-square estimate.
R2
coefficient of multiple determination from cross-validation.

See Also

pcr.model, simpls, kernelpls, plot.mvr, summary.mvr

Examples

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")

[Package Contents]