pls (version 1.2-1)

predplot: Prediction Plots

Description

Functions to plot predicted values against measured values for a fitted model.

Usage

predplot(object, ...)
## S3 method for class 'default':
predplot(object, \dots)
## S3 method for class 'mvr':
predplot(object, ncomp = object$ncomp, which, newdata, nCols, 
         nRows, xlab = "measured", ylab = "predicted",
         \dots, font.main = 1, cex.main = 1.1)
predplotXy(x, y, line = FALSE, main = "Prediction plot",
           xlab = "measured response", ylab = "predicted response",
           line.col = par("col"), line.lty = NULL, line.lwd = NULL, ...)

Arguments

object
a fitted model.
ncomp
integer vector. The model sizes (numbers of components) to use for prediction.
which
character vector. Which types of predictions to plot. Should be a subset of c("train", "validation", "test"). If not specified, plot.mvr selects test set predictions if newdata is supplied, otherwise cr
newdata
data frame. New data to predict.
nCols, nRows
integer. The number of coloumns and rows the plots will be laid out in. If not specified, plot.mvr tries to be intelligent.
xlab,ylab
titles for $x$ and $y$ axes. Typically character strings, but can be expressions or lists. See title for details.
font.main
font to use for main title. See par for details.
cex.main
numeric. The magnification to be used for main titles relative to the current size.
x
numeric vector. The observed response values.
y
numeric vector. The predicted response values.
line
logical. Whether a target line should be drawn.
main
character. Main title of plot.
line.col, line.lty, line.lwd
character or numeric. The col, lty and lwd parametres for the target line. See par for details.
...
further arguments sent to underlying plot functions.

Value

  • The functions invisibly returns a matrix with the (last) plotted data.

encoding

latin1

Details

predplot is a generic function for plotting predicted versus measured response values, with default and mvr methods currently implemented. The default method is very simple, and doesn't handle multiple responses or new data.

The mvr method, handles multiple responses, model sizes and types of predictions by making one plot for each combination. It can also be called through the plot method for mvr, by specifying plottype = "prediction" (the default).

predplotXy is an internal function and is not meant for interactive use. It is called by the predplot methods, and its arguments, e.g, line, can be given in the predplot call.

See Also

mvr, plot.mvr

Examples

Run this code
data(NIR)
mod <- plsr(y ~ X, ncomp = 10, data = NIR[NIR$train,], validation = "CV")
predplot(mod, ncomp = 1:6)
plot(mod, ncomp = 1:6) # Equivalent to the previous
## Both cross-validated and test set predictions:
predplot(mod, ncomp = 4:6, which = c("validation", "test"),
         newdata = NIR[!NIR$train,])

data(sensory)
mod.sens <- plsr(Quality ~ Panel, ncomp = 4, data = sensory)
plot(mod.sens, ncomp = 2:4) # Several responses gives several plots

Run the code above in your browser using DataLab