Latent Variable Plot for RR-VGLMs
lvplot.rrvglm.RdProduces an ordination diagram (also known as a biplot or latent variable plot) for reduced-rank vector generalized linear models (RR-VGLMs). For rank-2 models only, the x- and y-axis are the first and second canonical axes respectively.
Usage
lvplot.rrvglm(object,
A = TRUE, C = TRUE, scores = FALSE, show.plot = TRUE,
groups = rep(1, n), gapC = sqrt(sum(par()$cxy^2)), scaleA = 1,
xlab = "Latent Variable 1", ylab = "Latent Variable 2",
Alabels = if (length(object@misc$predictors.names))
object@misc$predictors.names else param.names("LP", M),
Aadj = par()$adj, Acex = par()$cex, Acol = par()$col,
Apch = NULL,
Clabels = rownames(Cmat), Cadj = par()$adj,
Ccex = par()$cex, Ccol = par()$col, Clty = par()$lty,
Clwd = par()$lwd,
chull.arg = FALSE, ccex = par()$cex, ccol = par()$col,
clty = par()$lty, clwd = par()$lwd,
spch = NULL, scex = par()$cex, scol = par()$col,
slabels = rownames(x2mat), ...)Arguments
- object
Object of class
"rrvglm".- A
Logical. Allow the plotting of A?
- C
Logical. Allow the plotting of C? If
TRUEthen C is represented by arrows emenating from the origin.- scores
Logical. Allow the plotting of the \(n\) scores? The scores are the values of the latent variables for each observation.
- show.plot
Logical. Plot it? If
FALSE, no plot is produced and the matrix of scores (\(n\) latent variable values) is returned. IfTRUE, the rank ofobjectneed not be 2.- groups
A vector whose distinct values indicate which group the observation belongs to. By default, all the observations belong to a single group. Useful for the multinomial logit model (see
multinomial.- gapC
The gap between the end of the arrow and the text labelling of C, in latent variable units.
- scaleA
Numerical value that is multiplied by A, so that C is divided by this value.
- xlab
Caption for the x-axis. See
par.- ylab
Caption for the y-axis. See
par.- Alabels
Character vector to label A. Must be of length \(M\).
- Aadj
Justification of text strings for labelling A. See the
adjargument ofpar.- Acex
Numeric. Character expansion of the labelling of A. See the
cexargument ofpar.- Acol
Line color of the arrows representing C. See the
colargument ofpar.- Apch
Either an integer specifying a symbol or a single character to be used as the default in plotting points. See
par. Thepchargument can be of length \(M\), the number of species.- Clabels
Character vector to label C. Must be of length \(p2\).
- Cadj
Justification of text strings for labelling C. See the
adjargument ofpar.- Ccex
Numeric. Character expansion of the labelling of C. See the
cexargument ofpar.- Ccol
Line color of the arrows representing C. See the
colargument ofpar.- Clty
Line type of the arrows representing C. See the
ltyargument ofpar.- Clwd
Line width of the arrows representing C. See the
lwdargument ofpar.- chull.arg
Logical. Plot the convex hull of the scores? This is done for each group (see the
groupargument).- ccex
Numeric. Character expansion of the labelling of the convex hull. See the
cexargument ofpar.- ccol
Line color of the convex hull. See the
colargument ofpar.- clty
Line type of the convex hull. See the
ltyargument ofpar.- clwd
Line width of the convex hull. See the
lwdargument ofpar.- spch
Either an integer specifying a symbol or a single character to be used as the default in plotting points. See
par. Thespchargument can be of length \(M\), number of species.- scex
Numeric. Character expansion of the labelling of the scores. See the
cexargument ofpar.- scol
Line color of the arrows representing C. See the
colargument ofpar.- slabels
Character vector to label the scores. Must be of length \(n\).
- ...
Arguments passed into the
plotfunction when setting up the entire plot. Useful arguments here includexlimandylim.
Details
For RR-VGLMs, a biplot and a latent variable
plot coincide.
In general, many of the arguments starting with
“A” refer to A (of length \(M\)),
“C” to C (of length \(p2\)),
“c” to the convex hull (of length length(unique(groups))),
and “s” to scores (of length \(n\)).
As the result is a biplot, its interpretation is based on the inner product.
Value
The matrix of scores (\(n\) latent variable values) is returned regardless of whether a plot was produced or not.
References
Yee, T. W. and Hastie, T. J. (2003). Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15–41.
Note
The functions lvplot.rrvglm and
biplot.rrvglm are equivalent.
In the example below the predictor variables are centered, which is a good idea.
Examples
set.seed(1)
nn <- nrow(pneumo) # x1--x3 are some unrelated covariates
pneumo <-
transform(pneumo, slet = scale(log(exposure.time)),
imag = severe + 3, # Fictitional!
x1 = rnorm(nn), x2 = rnorm(nn), x3 = rnorm(nn))
fit <-
rrvglm(cbind(normal, mild, severe, imag) ~ slet + x1 + x2 + x3,
# Corner = FALSE, Uncorrel = TRUE, # orig.
multinomial, data = pneumo, Rank = 2)
if (FALSE) { # \dontrun{
lvplot(fit, chull = TRUE, scores = TRUE, clty = 2, ccol = 4,
scol = "red", Ccol = "green3", Clwd = 2, Ccex = 2,
main = "Biplot of some fictitional data") } # }