Extraction of scores
and loadings
and adaptation of scoreplot
,
loadingplot
and biplot
from package pls
for sopls
objects.
# S3 method for sopls
loadings(object, ncomp = "all", block = 1, y = FALSE, ...)# S3 method for sopls
scores(object, ncomp = "all", block = 1, y = FALSE, ...)
# S3 method for sopls
scoreplot(
object,
comps = 1:2,
ncomp = NULL,
block = 1,
labels,
identify = FALSE,
type = "p",
xlab,
ylab,
...
)
# S3 method for sopls
loadingplot(
object,
comps = 1:2,
ncomp = NULL,
block = 1,
scatter = TRUE,
labels,
identify = FALSE,
type,
lty,
lwd = NULL,
pch,
cex = NULL,
col,
legendpos,
xlab,
ylab,
pretty.xlabels = TRUE,
xlim,
...
)
# S3 method for sopls
corrplot(
object,
comps = 1:2,
ncomp = NULL,
block = 1,
labels = TRUE,
col = 1:5,
plotx = TRUE,
ploty = TRUE,
...
)
# S3 method for sopls
biplot(
x,
comps = 1:2,
ncomp = "all",
block = 1,
which = c("x", "y", "scores", "loadings"),
var.axes = FALSE,
xlabs,
ylabs,
main,
...
)
sopls
object
integer
vector giving components from all blocks before block
(see next argument).
integer
indicating which block to extract components from.
logical
extract Y loadings/scores instead of X loadings/scores (default = FALSE).
further arguments sent to the underlying plot function(s)
integer
vector giving components, within block, to plot (see Details regarding combination of blocks).
character
indicating if "names" or "numbers" should be plot symbols (optional).
logical
for activating identify
to interactively identify points.
character
for selecting type of plot to make. Defaults to "p" (points) for scatter plots and "l" (lines) for line plots.
character
text for x labels.
character
text for y labels.
logical
indicating if a scatterplot of loadings should be made (default = TRUE).
Vector of line type specifications (see par
for details).
numeric
vector of line width specifications.
Vector of point specifications (see points
for details).
numeric
vector of plot size expansions (see par
for details).
integer
vector of symbol/line colours (see par
for details).
character
indicating legend position (if scatter
is FALSE), e.g. legendpos = "topright"
.
logical
indicating if xlabels should be more nicely plotted (default = TRUE).
numeric
vector of length two, with the x limits of the plot (optional).
locical
or integer
/character
. Whether to plot the TRUE
.
logical
. Whether to plot the TRUE
.
sopls
object
character
for selecting type of biplot ("x" = default, "y", "scores", "loadings").
logical
indicating if second axes of a biplot should have arrows.
character
vector for labelling first set of biplot points (optional).
character
vector for labelling second set of biplot points (optional).
character
for setting the main title of a plot.
If comps
is supplied as a list
for scoreplot
, it is assumed that its elements refer to each of the
blocks up to block number block
. For instance comps = list(1, 0, 1:2)
will select 1 component from the first
block, no components from the second block and the first two components from the last block. This must be
matched by ncomp
, specifying how many components were selected before block number block
.
Overviews of available methods, multiblock
, and methods organised by main structure: basic
, unsupervised
, asca
, supervised
and complex
.
Common functions for computation and extraction of results are found in sopls_results
.
#' @return The score and loading functions return scores and loadings, while plot functions have no return (except use of 'identify').
data(potato)
so <- sopls(Sensory ~ Chemical + Compression + NIRraw, data=potato, ncomp=c(5,5,5))
# Loadings
loadings(so, ncomp=c(3), block=2)[, 1:3]
# Scores
scores(so, block=1)[, 1:4]
# Default plot from first block
scoreplot(so)
# Second block with names
scoreplot(so, ncomp=c(3), block=2, labels="names")
# Scatterplot matrix
scoreplot(so, ncomp=c(3,2), block=3, comps=1:3)
# Combination of blocks (see Details)
scoreplot(so, ncomp=c(3,2), block=3, comps=list(1,0,1))
# Default plot from first block
loadingplot(so, scatter=TRUE)
# Second block with names
loadingplot(so, ncomp=c(3), block=2, labels="names", scatter=TRUE)
# Scatterplot matrix
loadingplot(so, ncomp=c(3,2), block=3, comps=1:3, scatter=TRUE)
# Correlation loadings
corrplot(so, block=2, ncomp=1)
# Default plot from first block
biplot(so)
Run the code above in your browser using DataLab