Description Usage Arguments Details Value Examples
View source: R/occ_functions.R
This function fits the single species, single season site occupancy model first developed by MacKenzie et al. (2002).
1 2 3 4 5 6 7 8 9 10 11 |
occupancy |
model declaration for the occupancy portion of the model using standard linear model syntax |
detection |
model declaration for the detection portion of the model using standard linear model syntax |
data |
data from which to create the detection and covariate matrices. Each row should represent a single visit to a site. See details and examples for proper formatting |
niter |
number of MCMC iterations |
nchains |
number of MCMC chains |
seed |
optional seed |
save_model |
logical; should a text file containing the model be exported? |
model_name |
character string defining the name of the text file
describing the model if |
beta_prior |
character string defining prior distribution for regression coefficients at the occupancy and detection levels. Priors should be specified using distributions available in NIMBLE. See available distributons in NIMBLE |
This function fits the single season, single species site occupancy
model using the logit link function. The data
should contain columns
named site
, visit
, and y
. See examples.
an object of class list
containing the following:
samples
object of class list
of length nchains
, each
containing a matrix
posterior samples
loglik
object of class list
of length codenchains, each
containing a matrix
of samples of the log posterior likelihood
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # simulate data
sim <- sim_occ(M = 100, max_j = 10, seed = 01012021, rand_visits = FALSE)
data <- sim$data
# note structure of data frame
names(data)
head(data)
# fit model
ex <- occ_mod(occupancy = ~ psi_cov1, detection = ~ p_cov1, data = data,
niter = 4000, beta_prior = "dunif(-5, -2)")
# results
ex
summary(ex)
str(ex)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.