library(mvabund) ## Load a dataset from the mvabund package
library(corrplot) ## For plotting correlations
data(spider)
y <- spider$abun
n <- nrow(y); p <- ncol(y);
spider.fit.nb <- boral(y, X = spider$X, family = "negative.binomial", num.lv = 2,
site.eff = FALSE, n.burnin = 10, n.iteration = 100,
n.thin = 1, save.model = TRUE, calc.ics = FALSE)
res.cors <- get.residual.cor(y, fit.mcmc = as.mcmc(spider.fit.nb$jags.model)[[1]])
corrplot(res.cors, title = "Residual correlations", type = "lower")
Run the code above in your browser using DataLab