pls (version 2.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, comps, intercept = FALSE,
         separate = FALSE, nCols, nRows, labels, type = "l",
         lty = 1:nLines, lwd = NULL, pch = 1:nLines, cex = NULL,
         col = 1:nLines, legendpos, xlab = "variable",
         ylab = "regression coefficient", main, pretty.xlabels = TRUE,
         xlim, ...)

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

The argument labels can be a vector of labels or one of "names" and "numbers". The labels are used as $x$ axis labels. If labels is "names" or "numbers", the variable names are used as labels, the difference being that with "numbers", the variable names are converted to numbers, if possible. Variable names of the forms "number" or "number text" (where the space is optional), are handled.

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. (To have different settings for the two titles, one can override the par settings with arguments to coefplot.)

The argument pretty.xlabels is only used when labels is specified. If TRUE (default), the code tries to use a pretty selection of labels. If labels is "numbers", it also uses the numerical values of the labels for horisontal spacing. If one has excluded parts of the spectral region, one might therefore want to use pretty.xlabels = FALSE.

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(yarn)
mod.nir <- plsr(density ~ NIR, ncomp = 8, data = yarn)
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(oliveoil)
mod.sens <- plsr(sensory ~ chemical, ncomp = 4, data = oliveoil)
coefplot(mod.sens, ncomp = 2:4, separate = TRUE)

Run the code above in your browser using DataLab