scoreplot {pls}R Documentation

Plots of Scores and Loadings

Description

Functions to make scatter plots of scores and scatter or line plots of loadings.

Usage

scoreplot(object, comps = 1:2, labels, identify = FALSE, type = "p", ...)
## S3 method for class 'scores':
plot(x, ...)

loadingplot(object, comps = 1:2, scatter = FALSE, labels, identify = FALSE,
            type, ...)
## S3 method for class 'loadings':
plot(x, ...)

Arguments

object an mvr object. The fitted model.
comps integer vector. The components to plot.
scatter logical. Whether the loadings should be plotted as a scatter instead of as lines.
labels optional. Labels to use instead of plotting symbols. Ignored in loadingplot unless scatter = TRUE. Either a vector (of length > 1) of labels, or one of "names" and "numbers" for using row names and row numbers, respectively.
identify logical. Whether to use identify to interactively identify points. See below.
type character. What type of plot to make. Defaults to "p" (points) for scatter plots and "l" (lines) for line plots.
x a scores or loadings object. The scores or loadings to plot.
... further arguments sent to the underlying plot function(s).

Details

plot.scores is simply a wrapper calling scoreplot, passing all arguments. Similarly for plot.loadings.

scoreplot makes one or more scatter plots of the scores, depending on how many components are selected. If one or two components are selected, and identify is TRUE, the function identify is used to interactively identify points.

If scatter is TRUE, loadingplot works exactly like scoreplot. Otherwise, it makes a lineplot of the selected loading vectors, and if identify is TRUE, uses identify to interactively identify points.

scoreplot and loadingplot can also be called through the plot method for mvr objects, by specifying plottype as "scores" or "loadings". See plot.mvr.

scoreplot and loadingplot also work with princomp objects. (However, plot(scores(...)) and plot(loadings(...)) will not work.)

Value

The functions return whatever the underlying plot function (or identify) returns.

Author(s)

Ron Wehrens and Bjørn-Helge Mevik

See Also

mvr, plot.mvr, scores, loadings

Examples

data(NIR)
mod <- plsr(y ~ X, ncomp = 10, data = NIR)
## These three are equivalent:
## Not run: scoreplot(mod, comps = 1:5)
## Not run: plot(scores(mod), comps = 1:5)
## Not run: plot(mvr, plottype = "scores", comps = 1:5)

## Not run: loadingplot(mod, comps = 1:5)
## Not run: loadingplot(mod, comps = 1:5, scatter = TRUE) # Plot as scatterplots

[Package pls version 1.0-2 Index]