Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ordiplot.gllvm

Plot latent variables from gllvm model


Description

Plots latent variables and their corresponding coefficients (biplot).

Usage

## S3 method for class 'gllvm'
ordiplot(
  object,
  biplot = FALSE,
  ind.spp = NULL,
  alpha = 0.5,
  main = NULL,
  which.lvs = c(1, 2),
  predict.region = FALSE,
  level = 0.95,
  jitter = FALSE,
  jitter.amount = 0.2,
  s.colors = 1,
  symbols = FALSE,
  cex.spp = 0.7,
  spp.colors = "blue",
  lwd.ellips = 0.5,
  col.ellips = 4,
  lty.ellips = 1,
  ...
)

Arguments

object

an object of class 'gllvm'.

biplot

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

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).

predict.region

logical, if TRUE prediction regions for the predicted latent variables are plotted, defaults to FALSE.

level

level for prediction regions.

jitter

if TRUE, jittering is applied on points.

jitter.amount

numeric, positive value indicating an amount of jittering for each point, defaults to 0.2 (jitter range).

s.colors

colors for sites

symbols

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

cex.spp

size of species labels in biplot

spp.colors

colors for sites, defaults to "blue"

lwd.ellips

line width for prediction ellipses. See graphical parameter lwd.

col.ellips

colors for prediction ellipses.

lty.ellips

line type for prediction ellipses. See graphical parameter lty.

...

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. For details for constructing a biplot, see Gabriel (1971).

Note

- If error is occurred when using ordiplot(), try full name of the function ordiplot.gllvm() as functions named 'ordiplot' might be found in other packages as well.

Author(s)

Jenni Niku <jenni.m.e.niku@jyu.fi>, Francis K.C. Hui

References

Gabriel, K. R. (1971). The biplot graphic display of matrices with application to principal component analysis. Biometrika, 58, 453-467.

Examples

#'# Extract subset of the microbial data to be used as an example
data(microbialdata)
y <- microbialdata$Y[, order(colMeans(microbialdata$Y > 0), 
                     decreasing = TRUE)[21:40]]
fit <- gllvm(y, family = poisson())
fit$logL
ordiplot(fit, predict.region = TRUE)
## 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)

## End(Not run)

gllvm

Generalized Linear Latent Variable Models

v1.3.0
GPL-2
Authors
Jenni Niku [aut, cre], Wesley Brooks [aut], Riki Herliansyah [aut], Francis K.C. Hui [aut], Sara Taskinen [aut], David I. Warton [aut], Bert van der Veen [aut]
Initial release
2021-4-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.