scoreplot {pls} | R Documentation |
Functions to make scatter plots of scores or correlation loadings, and scatter or line plots of loadings.
scoreplot(object, ...) ## Default S3 method: scoreplot(object, comps = 1:2, labels, identify = FALSE, type = "p", xlab, ylab, ...) ## S3 method for class 'scores': plot(x, ...) loadingplot(object, ...) ## Default S3 method: loadingplot(object, comps = 1:2, scatter = FALSE, labels, identify = FALSE, type, lty, lwd = NULL, pch, cex = NULL, col, legendpos, xlab, ylab, ...) ## S3 method for class 'loadings': plot(x, ...) corrplot(object, comps = 1:2, labels, identify = FALSE, type = "p", xlab, ylab, ...)
object |
an R 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.
If scatter = FALSE in loadingplot , they are used to
label the x axis tick marks. 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. See plot for a complete list
of types (not all types are possible/meaningful for all plots). |
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 scatter 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() ). |
xlab,ylab |
titles for x and y axes. Typically
character strings, but can be expressions or lists. See
title for details. |
x |
a scores or loadings object. The scores or
loadings to plot. |
... |
further arguments sent to the underlying plot function(s). |
plot.scores
is simply a wrapper calling scoreplot
,
passing all arguments. Similarly for plot.loadings
.
scoreplot
is generic, currently with a default method that
works for matrices and any object for which scores
returns a matrix. The default scoreplot
method
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.
Also loadingplot
is generic, with a default method that works
for matrices and any object where loadings
returns a
matrix. If scatter
is TRUE
, the default method works exactly
like the default scoreplot
method. Otherwise, it makes a lineplot of the selected
loading vectors, and if identify
is TRUE
,
uses identify
to interactively identify points. Also,
if legendpos
is given, a legend is drawn at the position
indicated.
corrplot
works exactly like the default scoreplot
method, except that at
least two components must be selected. The “correlation
loadings”, i.e. the correlations between each variable and the
selected components, are plotted as pairwise scatter plots, with
two concentric circles of radius 0.5 and 1.
scoreplot
, loadingplot
and corrplot
can also be
called through the plot method for mvr
objects, by specifying
plottype
as "scores"
, "loadings"
or
"correlation"
, respectively. See plot.mvr
.
The functions return whatever the underlying plot function (or
identify
) returns.
legend
has many options. If you want greater
control over the appearance of the legend, omit the legendpos
argument and call legend
manually.
Graphical parametres (such as pch
and cex
) can also
be used with scoreplot
and corrplot
. They are not
listed in the argument list simply because they are not handled
specifically in the function (unlike in loadingplot
), but
passed directly to the underlying plot functions by ...
.
Ron Wehrens and Bjørn-Helge Mevik
mvr
, plot.mvr
,
scores
, loadings
, identify
,
legend
data(NIR) mod <- plsr(y ~ X, ncomp = 10, data = NIR) ## These three are equivalent: ## Not run: scoreplot(mod, comps = 1:5) plot(scores(mod), comps = 1:5) plot(mod, plottype = "scores", comps = 1:5) loadingplot(mod, comps = 1:5) loadingplot(mod, comps = 1:5, legendpos = "topright") # With legend loadingplot(mod, comps = 1:5, scatter = TRUE) # Plot as scatterplots corrplot(mod, comps = 1:2) corrplot(mod, comps = 1:3) ## End(Not run)