Learn R Programming

gllvm (version 1.0)

plot.gllvm: Plot Diagnostics for an gllvm Object

Description

Four plots (selectable by which) are currently available: a plot of residuals against linear predictors of fitted values, a Normal Q-Q plot of residuals, residuals against row index and residuals against column index.

Usage

# S3 method for gllvm
plot(x, which = 1:4,
  caption = c("Residuals vs linear predictors", "Normal Q-Q",
  "Residuals vs row index", "Residuals vs column index"), var.colors = NULL,
  ...)

Arguments

x

an object of class 'gllvm'.

which

if a subset of the plots is required, specify a subset of the numbers 1:4, see caption below.

caption

captions to appear above the plots.

var.colors

colors for responses, vector with length of number of response variables or 1. Defaults to NULL, when different responses have different colors.

...

additional graphical arguments.

Details

plot.gllvm is used for model diagnostics. Dunn-Smyth residuals or randomized quantile residuals (Dunn and Smyth, 1996) are used in plots. Colors indicate different species.

References

Dunn, P. K., and Smyth, G. K. (1996). Randomized quantile residuals. Journal of Computational and Graphical Statistics, 5, 236-244.

Hui, F. K. C., Taskinen, S., Pledger, S., Foster, S. D., and Warton, D. I. (2015). Model-based approaches to unconstrained ordination. Methods in Ecology and Evolution, 6:399-411.

See Also

gllvm, residuals.gllvm

Examples

Run this code
# NOT RUN {
## Load a dataset from the mvabund package
data(antTraits)
y <- as.matrix(antTraits$abund)
# Fit gllvm model with Poisson family
fit <- gllvm(y, family = "poisson")
# Plot residuals
plot(fit, mfrow = c(2,2))

# }
# NOT RUN {
# Fit gllvm model with negative binomial family
fitnb <- gllvm(y = y, family = "negative.binomial")
# Plot residuals
plot(fitnb, mfrow = c(2,2))
# Plot only two first plots
plot(fitnb, which = 1:2, mfrow = c(1,2))
# }

Run the code above in your browser using DataLab