coefplot {pls}R Documentation

Plot Regression Coefficients of PLSR and PCR models

Description

Function to plot the regression coefficients of an mvr object.

Usage

coefplot(object, ncomp = object$ncomp, separate = FALSE, cumulative = TRUE,
         intercept = FALSE, nCols, nRows, varnames = FALSE, type = "l",
         lty = 1:nLines, lwd = NULL, pch = 1:nLines, cex = NULL,
         col = 1:nLines, legendpos, xlab = "variable",
         ylab = "regression coefficient", ...)

Arguments

object an mvr object. The fitted model.
ncomp integer vector. The number of components to include. If length(ncomp) > 1, coefficients for each model size is plotted.
separate logical. If TRUE, coefficients for different model sizes are blotted in separate plots.
cumulative logical. Whether cumulative (the default) or individual coefficients for each component should be plotted. See coef.mvr for details.
intercept logical. Whether coefficients for the intercept should be plotted. Ignored if cumulative = FALSE. Defaults to FALSE. See coef.mvr for details.
nCols, nRows integer. The number of coloumns and rows the plots will be laid out in. If not specified, coefplot tries to be intelligent.
varnames logical. If TRUE, the x axis tick marks are labelled with the variable names.
type character. What type of plot to make. Defaults to "l" (lines). Alternative types include "p" (points) and "b" (both). See plot for a complete list of types.
lty vector of line types (recycled as neccessary). Line types can be specified as integers or character strings (see par for the details).
lwd vector of positive numbers (recycled as neccessary), giving the width of the lines.
pch plot character. A character string or a vector of single characters or integers (recycled as neccessary). See points for all alternatives.
cex numeric vector of character expansion sizes (recycled as neccessary) for the plotted symbols.
col character or integer vector of colors for plotted lines and symbols (recycled as neccessary). See par for the details.
legendpos Legend position. Optional. Ignored if separate is TRUE. If present, a legend is drawn at the given position. The position can be specified symbolically (e.g., legendpos = "topright"). This requires R >= 2.1.0. Alternatively, the position can be specified explicitly (legendpos = t(c(x,y))) or interactively (legendpos = locator()). This only works well for plots of single-response models.
xlab,ylab titles for x and y axes. Typically character strings, but can be expressions (e.g., expression(R^2) or lists. See title for details.
... Further arguments sent to the underlying plot functions.

Details

coefplot handles multiple responses by making one plot for each response. If separate is TRUE, separate plots are made for each combination of model size and response. The plots are laid out in a rectangular fashion.

If legendpos is given, a legend is drawn at the given position (unless separate is TRUE).

If varnames is TRUE, the x axis tick marks are labelled with the regressor variable names. Hint: If there is not enough room for all names to be displayed, try reducing the text size by giving the argument cex.axis with a value less than 1, or try printing the names vertically by giving the argument las = 3.

The function can also be called through the mvr plot method by specifying plottype = "coefficients".

Note

legend has many options. If you want greater control over the appearance of the legend, omit the legendpos argument and call legend manually.

Author(s)

Ron Wehrens and Bjørn-Helge Mevik

See Also

mvr, plot.mvr, coef.mvr, plot, legend

Examples

data(NIR)
mod.nir <- plsr(y ~ X, ncomp = 8, data = NIR)
## Not run: 
coefplot(mod.nir, ncomp = 1:6)
plot(mod.nir, plottype = "coefficients", ncomp = 1:6) # Equivalent to the previous
## Plot with legend:
coefplot(mod.nir, ncom = 1:6, legendpos = "bottomright")
## End(Not run)

data(sensory)
mod.sens <- plsr(Quality ~ Panel, ncomp = 4, data = sensory)
## Not run: coefplot(mod.sens, ncomp = 2:4, separate = TRUE)

[Package pls version 1.1-0 Index]