Description Usage Arguments Details Value Examples
occupancy is a function to fit occupancy-detection models in JAGS from within R. Models are specified with a formula interface and are supported by methods to summarise, visualise, validate, and predict from fitted models.
occupancy lets you fit occupancy-detection models in JAGS without having to prepare JAGS code. Models are specified with a formula interface and can incorporate random effects. Models are supported by several methods to summarise, visualise, validate, and predict from fitted models.
1 2 |
formula_occ |
model formula for occupancy component of the model. A two-sided
formula with the response variable on the left of the |
formula_detect |
model formula for detection component of the model. A one-sided
formula with predictor variables on the right, formatted as for |
site_id |
the name of the column in |
survey_id |
the name of the column in |
data |
a |
jags_settings |
optional list of MCMC settings. Any or all items can be altered if needed. Options are:
|
This function fits an occupancy-detection model in JAGS from two formulas:
formula_occ
and formula_detect
. Occupancy-detection models separate
the two processes of being present at a site and being detect given presence at
a site. This requires data from repeated visits (surveys) to sites.
The occupancy component of the model (presence at a site) is defined at the site level. The detection component of the model (detections given presence) is defined at the survey level. The model assumes that associations between occupancy/detection and predictor variables are linear on a logit scale.
occupancy_model
- a list
object that can be analysed using
functions described in methods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## Not run:
# fit a model to simulated data
mod <- occupancy(response ~ occ_predictor1 + occ_predictor2 +
(1 | occ_random1) + (1 | occ_random2),
~ detect_predictor1 + detect_predictor2 +
(1 | detect_random1),
site_id = "site",
survey_id = "survey",
data = occupancy_data,
jags_settings = list(n_iter = 1000, n_burnin = 500, n_thin = 2))
# plot the model coefficients
par(mfrow = c(2, 1))
plot(mod)
# extract the model coefficients
coef(mod)
# check model fit
calculate_metrics(mod)
## End(Not run)
## Not run:
# a simple occupancy-detection model for artificial data
# build and sample
# plot coefficients
# validate
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.