Learn R Programming

camtrapR (version 2.2.0)

fit,commOccu-method: Fit a community (multi-species) occupancy model

Description

Convenience function for fitting community occupancy models (defined in a commOccu object) in JAGS or Nimble.

Usage

# S4 method for commOccu
fit(
  object,
  n.iter = 100,
  thin = 1,
  n.burnin = 0,
  n.adapt = 0,
  cores = 1,
  chains = 3,
  compile = TRUE,
  WAIC = FALSE,
  quiet = FALSE,
  ...
)

Arguments

object

commOccu object

n.iter

number of iterations to monitor

thin

thinning interval for monitors

n.burnin

burnin length

n.adapt

Length of adaptive phase

cores

number of cores to utilize

chains

number of MCMC chains to run

compile

logical. If Nimble model, compile model with compileNimble before running model?

WAIC

logical. Return WAIC (only Nimble models)

quiet

if TRUE messages and progress bar will be suppressed

...

additional arguments to pass to runMCMC (only relevant for Nimble)

Value

A coda::mcmc.list

Details

Models will be fit either in JAGS or Nimble, depending on the decision made in the nimble argument in communityModel.

For Nimble, compilation is strongly recommended for long model runs. Uncompiled models can run extremely slow. Compilation itself can take a while also, and requires that Rtools is available on the system.

It is a convenience function only which hides some of the configuration options. If you require more control over model fitting, you can run all steps individually. See vignette 5 for details.