Learn R Programming

VGAM (version 1.1-3)

lvplot.rrvglm: Latent Variable Plot for RR-VGLMs

Description

Produces 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 TRUE then 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. If TRUE, the rank of object need 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 adj argument of par.

Acex

Numeric. Character expansion of the labelling of A. See the cex argument of par.

Acol

Line color of the arrows representing C. See the col argument of par.

Apch

Either an integer specifying a symbol or a single character to be used as the default in plotting points. See par. The pch argument 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 adj argument of par.

Ccex

Numeric. Character expansion of the labelling of C. See the cex argument of par.

Ccol

Line color of the arrows representing C. See the col argument of par.

Clty

Line type of the arrows representing C. See the lty argument of par.

Clwd

Line width of the arrows representing C. See the lwd argument of par.

chull.arg

Logical. Plot the convex hull of the scores? This is done for each group (see the group argument).

ccex

Numeric. Character expansion of the labelling of the convex hull. See the cex argument of par.

ccol

Line color of the convex hull. See the col argument of par.

clty

Line type of the convex hull. See the lty argument of par.

clwd

Line width of the convex hull. See the lwd argument of par.

spch

Either an integer specifying a symbol or a single character to be used as the default in plotting points. See par. The spch argument can be of length \(M\), the number of species.

scex

Numeric. Character expansion of the labelling of the scores. See the cex argument of par.

scol

Line color of the arrows representing C. See the col argument of par.

slabels

Character vector to label the scores. Must be of length \(n\).

Arguments passed into the plot function when setting up the entire plot. Useful arguments here include xlim and ylim.

Value

The matrix of scores (\(n\) latent variable values) is returned regardless of whether a plot was produced or not.

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.

References

Yee, T. W. and Hastie, T. J. (2003). Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15--41.

See Also

lvplot, par, rrvglm, Coef.rrvglm, rrvglm.control.

Examples

Run this code
# NOT RUN {
nn <- nrow(pneumo)  # x1, x2 and x3 are some unrelated covariates
pneumo <- transform(pneumo, slet = scale(log(exposure.time)),
                              x1 = rnorm(nn), x2 = rnorm(nn), x3 = rnorm(nn))
fit <- rrvglm(cbind(normal, mild, severe) ~ slet + x1 + x2 + x3,
              multinomial, data = pneumo, Rank = 2,
              Corner = FALSE, Uncorrel = TRUE)
# }
# NOT RUN {
lvplot(fit, chull = TRUE, scores = TRUE, clty = 2, ccol = "blue",
       scol = "red", Ccol = "darkgreen", Clwd = 2, Ccex = 2,
       main = "Biplot of some fictitional data") 
# }

Run the code above in your browser using DataLab