Learn R Programming

gllvm (version 1.0)

ordiplot.gllvm: Plot latent variables from gllvm model

Description

Plots latent variables and their corresponding coefficients (biplot).

Usage

# S3 method for gllvm
ordiplot(object, biplot = FALSE, ind.spp = NULL,
  alpha = 0.5, main = NULL, which.lvs = c(1, 2), jitter = FALSE,
  s.colors = 1, symbols = FALSE, ...)

Arguments

object

an object of class 'gllvm'.

biplot

TRUE if both latent variables and their coefficients are plotted, FALSE if only LVs.

ind.spp

the number of response variables (usually, species) to include on the biplot. The default is none, or all if biplot = TRUE.

alpha

a numeric scalar between 0 and 1 that is used to control the relative scaling of the latent variables and their coefficients, when constructing a biplot.

main

main title.

which.lvs

indices of two latent variables to be plotted if number of the latent variables is more than 2. A vector with length of two. Defaults to c(1,2).

jitter

if TRUE, jittering is applied on points.

s.colors

colors for sites

symbols

logical, if TRUE sites are plotted using symbols, if FALSE (default) site numbers are used

...

additional graphical arguments.

Details

Function constructs a scatter plot of two latent variables, i.e. an ordination plot. If only one latent variable is in the fitted model, latent variables are plotted against their corresponding row indices. The latent variables are labeled using the row index of the response matrix y.

Coefficients related to latent variables are plotted in the same figure with the latent variables if biplot = TRUE. They are labeled using the column names of y. The number of latent variable coefficients to be plotted can be controlled by ind.spp. An argument alpha is used to control the relative scaling of the latent variables and their coefficients. If alpha = 0.5, the latent variables and their coefficients are on the same scale.

Examples

Run this code
# NOT RUN {
#'## Load a dataset from the mvabund package
data(antTraits)
y <- as.matrix(antTraits$abund)
fit <- gllvm(y, family = "poisson")
# Ordination plot:
ordiplot(fit)
# Biplot with 10 species
ordiplot(fit, biplot = TRUE, ind.spp = 10)

# }

Run the code above in your browser using DataLab