library(mvabund) ## Load a dataset from the mvabund package
data(spider)
y <- spider$abun
n <- nrow(y); p <- ncol(y);
## Example 1 - model with two latent variables, site effects,
## and no environmental covariates
spider.fit.nb <- boral(y, family = "negative.binomial", num.lv = 2,
site.eff = TRUE, save.model = TRUE)
## Returns a list with components corresponding to values described above.
spider.fit.nb$hpdintervals
## Example 2 - model with one latent variable, site effects,
## and environmental covariates
spider.fit.nb2 <- boral(y, X = spider$x, family = "negative.binomial", num.lv = 1,
site.eff = TRUE, save.model = TRUE)
## Returns a list with components corresponding to values described above.
spider.fit.nb2$hpdintervals
Run the code above in your browser using DataLab