Learn R Programming

pls (version 1.1-0)

coefplot: 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

encoding

latin1

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

See Also

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

Examples

Run this code
data(NIR)
mod.nir <- plsr(y ~ X, ncomp = 8, data = NIR)
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")

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

Run the code above in your browser using DataLab