ordiplot.gllvm {gllvm} | R Documentation |
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,
s.cex = 1.2,
symbols = FALSE,
cex.spp = 0.7,
spp.colors = "blue",
arrow.scale = 0.8,
arrow.spp.scale = 0.8,
arrow.ci = TRUE,
arrow.lty = "solid",
spp.arrows = NULL,
spp.arrows.lty = "dashed",
cex.env = 0.7,
lab.dist = 0.1,
lwd.ellips = 0.5,
col.ellips = 4,
lty.ellips = 1,
type = NULL,
rotate = TRUE,
...
)
Arguments
object |
an object of class 'gllvm'. |
biplot |
|
ind.spp |
the number of response variables (usually, species) to include on the biplot. The default is none, or all if |
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 |
predict.region |
if |
level |
level for prediction regions. |
jitter |
if |
jitter.amount |
numeric, positive value indicating an amount of jittering for each point, defaults to 0.2 (jitter range). |
s.colors |
colors for sites |
s.cex |
size of site labels |
symbols |
logical, if |
cex.spp |
size of species labels in biplot |
spp.colors |
colors for sites, defaults to |
arrow.scale |
positive value, to scale arrows |
arrow.spp.scale |
positive value, to scale arrows of species |
arrow.ci |
represent statistical uncertainty for arrows in constrained or concurrent ordination using confidence or prediction interval? Defaults to |
arrow.lty |
linetype for arrows in constrained |
spp.arrows |
plot species scores as arrows if outside of the range of the plot? Defaults to |
spp.arrows.lty |
linetype for species arrows |
cex.env |
size of labels for arrows in constrained ordination |
lab.dist |
distance between label and arrow heads. Value between 0 and 1 |
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. |
type |
which type of ordination plot to construct. Options are "residual", "conditional", and "marginal". Defaults to "residual" for GLLVMs with unconstrained latent variables and "conditional" otherwise. |
rotate |
logical, if |
... |
additional graphical arguments. |
Details
Function constructs a scatter plot of two latent variables, i.e. an ordination plot. Latent variables are re-rotated to their principal direction using singular value decomposition, so that the first plotted latent variable does not have to be the first latent variable in the model. 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).
For a quadratic response model, species optima are plotted. Any species scores that are outside the range of the predicted site scores are not directly plotted, but their main direction is indicated with arrows instead. This ensures that the plot remains on a reasonable scale.
Effects of environmental variables in constrained ordination are indicated with arrows. If any of the arrows exceeds the range of the plot, arrows are scaled to 80 but so that the relative contribution of predictors is maintained. If standard errors are available in the provided model, the slopes of environmental variables for which the 95 are slightly less intensely coloured.
For constrained ordination, a conditional plot includes both fixed- and random-effects to
optimally represent species co-occurrence patterns, corresponding to "conditional" site scores in getLV.gllvm
.
Marginal corresponds to an ordination plot that excludes residual patterns (i.e. excluding the random-effect),
so that it is only available with num.lv.c>0 or num.RR>0. A conditional plot requires num.lv.c>0.
The "residual" type corresponds to an ordination diagram of only residual patterns.
See getLV.gllvm for details.
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, Bert van der Veen
References
Gabriel, K. R. (1971). The biplot graphic display of matrices with application to principal component analysis. Biometrika, 58, 453-467.
See Also
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)