pls (version 2.1-0)

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", main,
         \dots, font.main, cex.main)
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

Value

  • The functions invisibly return 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).

The argument main can be used to specify the main title of the plot. It is handled in a non-standard way. If there is only on (sub) plot, main will be used as the main title of the plot. If there is more than one (sub) plot, however, the presence of main will produce a corresponding global title on the page. Any graphical parametres, e.g., cex.main, supplied to coefplot will only affect the ordinary plot titles, not the global one. Its appearance can be changed by setting the parameters with par, which will affect both titles (with the exception of font.main and cex.main, which will only affect the global title when there is more than one plot). (To have different settings for the two titles, one can override the par settings with arguments to predplot.)

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(yarn)
mod <- plsr(density ~ NIR, ncomp = 10, data = yarn[yarn$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 = yarn[!yarn$train,])

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

Run the code above in your browser using DataLab