plsrPlot: Perform PLS regression and draw important plots at once

Description Usage Arguments Details Value References See Also Examples

Description

The function plsrPlot performs the partial least squares (PLS) regression by using the function plsr in 'pls' package and draws four kinds of plots (cross-validation, regression vector, variable importance [selectivity ratio and variable importance in projection], actual vs. predicted value) at once.

Usage

1
2
3
4
5
plsrPlot(formula = NULL, data = NULL, testdata = NULL, yTrain = NULL,
  xTrain = NULL, xTest = NULL, yTest = NULL, yname = NULL,
  ncomp = "auto", maxcomp = 10, plot = TRUE, validation = "CV",
  segment.type = "interleaved", output = FALSE, dir = NULL,
  return.stats = FALSE, ...)

Arguments

formula

a model formula (see below).

data

an optional data frame with the data to fit the model form.

testdata

data set for prediction.

ncomp

the number of components (latent variables) to include in the model (see below).

maxcomp

Maximum number of components (latent variables) to be used for cross-validation.

plot

if TRUE, the four plots are drawn.

output

if TRUE, the results are output as PDF and CSV files.

dir

path to the directory where the results are output (default value is "PLSR_result").

return.stats

if TRUE, an object of class data.frame containing the statistics of PLS regression is returned.

...

additional arguments passed to the plsr in 'pls' package.

Details

The formula argument should be a symbolic formula of the form response ~ terms, where response is the name of the response vector and terms is the name of the predictor matrix, e.g., water ~ FTIR. See plsr for a detailed description.

If ncomp = "auto", the optimum number of components is automatically selected (see ncompopt).

Value

If return.stats = TRUE, an object of class data.frame containing the statistics of PLS regression is returned. Otherwise, an object of class mvr is returned (see plsr).

References

Vignette https://www.gitbook.com/book/uwadaira/plsropt_vignette_ver1-2-0

See Also

ncompopt, plsr

Examples

1
2
# alternative way
result <- plsrPlot(yTrain = datTrain$Brix, xTrain = datTrain$NIR, yTest=datTest$Brix, xTest=datTest$NIR)

uwadaira/plsropt documentation built on May 3, 2019, 2:39 p.m.