This helper plots the individuals and predictors from a fitted
plsR or plsRglm model while coloring the
individuals according to a grouping variable.
classbiplot(
object,
group = NULL,
comps = 1:2,
col,
colvar = "gray30",
pch = 19,
cex = rep(par("cex"), 2),
xlabs = NULL,
ylabs = NULL,
point.labels = FALSE,
show.legend = TRUE,
legendpos = "topright",
var.axes = TRUE,
expand = 1,
xlim = NULL,
ylim = NULL,
arrow.len = 0.1,
main = NULL,
sub = NULL,
xlab = NULL,
ylab = NULL,
...
)Invisibly returns a list with the scores, loadings, colors, grouping factor and scaling ratio used in the plot.
an object containing score and loading matrices in
object$tt and object$pp, typically returned by
plsR or plsRglm.
optional grouping vector for the individuals. When supplied,
observations are colored according to the levels of group.
integer vector of length 2 giving the components to display.
colors for the individuals. If group is provided,
col can have length 1, the number of groups, or the number of
individuals.
color used for variable labels, arrows and axes.
plotting character for the individuals.
character expansion. Length 1 is recycled to length 2: the first value is used for the individuals and the second one for the variables.
optional labels for the individuals.
optional labels for the variables.
shall the individuals be displayed using text labels
instead of points? Defaults to FALSE.
shall a legend be added when group is provided?
Defaults to TRUE.
position of the legend as in
legend, defaults to "topright".
shall arrows be drawn for the variables? Defaults to
TRUE.
expansion factor for the variables layer, as in
biplot. Defaults to 1.
limits for the scores panel. When both are missing they are
chosen symmetrically as in biplot.
length of the arrows for the variables.
usual graphical parameters passed to
plot.
further graphical parameters passed to
plot for the scores panel.
Frédéric Bertrand
frederic.bertrand@lecnam.net
https://fbertran.github.io/homepage/
plsR, plsRglm,
biplot
data(Cornell)
modpls <- plsR(Y ~ ., data = Cornell, nt = 2)
grp <- factor(Cornell$Y > median(Cornell$Y), labels = c("Low", "High"))
classbiplot(modpls, group = grp, col = c("firebrick3", "steelblue3"))
Run the code above in your browser using DataLab