# NOT RUN {
## NOTE: The values below MUST NOT be used in a real application;
## they are only used here to make the examples run quick!!!
example_mcmc_control <- list(n.burnin = 10, n.iteration = 100,
n.thin = 1)
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
spiderfit_nb <- boral(y, family = "negative.binomial", lv.control = list(num.lv = 2),
row.eff = "fixed", save.model = TRUE, mcmc.control = example_mcmc_control)
## Returns a list with components corresponding to values described above.
spiderfit_nb$hpdintervals
## Example 2 - model with two latent variable, site effects,
## and environmental covariates
spiderfit_nb2 <- boral(y, X = spider$x, family = "negative.binomial",
lv.control = list(num.lv = 2), row.eff = "fixed", save.model = TRUE,
mcmc.control = example_mcmc_control)
## Returns a list with components corresponding to values described above.
spiderfit_nb2$hpdintervals
# }
Run the code above in your browser using DataLab