library(mvabund) ## Load a dataset from the mvabund package
data(spider)
y <- spider$abun
spider.fit.p <- boral(y, family = "poisson", num.lv = 2, site.eff = TRUE,
n.burnin = 10, n.iteration = 100, n.thin = 1,
save.model = FALSE, calc.ics = FALSE)
plot(spider.fit.p, which = 1:4)
## A distinct fan pattern is observed in the plot of Dunn-Smyth residuals
## versus linear predictors plot.
## The normal quantile plot also suggests some lack of fit.
spider.fit.nb <- boral(y, family = "negative.binomial", num.lv = 2,
site.eff = TRUE, n.burnin = 10, n.iteration = 100, n.thin = 1,
save.model = FALSE, calc.ics = FALSE)
plot(spider.fit.nb, which = 1:4)
## The fan shape is not as clear now,
## and the normal quantile plot also suggests a better fit to the data
Run the code above in your browser using DataLab