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

plot.gllvm

Plot Diagnostics for an gllvm Object


Description

Five plots (selectable by which) are currently available: a plot of residuals against linear predictors of fitted values, a Normal Q-Q plot of residuals with a simulated point-wise 95% confidence interval envelope, residuals against row index and column index and scale location plot.

Usage

## S3 method for class 'gllvm'
plot(
  x,
  which = 1:5,
  caption = c("Residuals vs linear predictors", "Normal Q-Q", "Residuals vs row index",
    "Residuals vs column index", "Scale-Location"),
  var.colors = NULL,
  add.smooth = TRUE,
  envelopes = TRUE,
  reps = 150,
  envelope.col = c("blue", "lightblue"),
  n.plot = NULL,
  ...
)

Arguments

x

an object of class 'gllvm'.

which

if a subset of the plots is required, specify a subset of the numbers 1:5, 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.

add.smooth

logical indicating if a smoother should be added.

envelopes

logical, indicating if simulated point-wise confidence interval envelope will be added to Q-Q plot, defaults to TRUE

reps

number of replications when simulating confidence envelopes for normal Q-Q plot

envelope.col

colors for envelopes, vector with length of two

n.plot

number of species (response variables) to be plotted. Defaults to NULL when all response variables are plotted. Might be useful when data is very high dimensional.

...

additional graphical arguments.

Details

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

Author(s)

Jenni Niku <jenni.m.e.niku@jyu.fi>

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

Examples

## 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(3,2))

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

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