get_classic.Rd
Creates model code using the nimbleCode
function.
get_classic(
dim_y,
enc_dist = "binomial",
sex_sigma = FALSE,
hab_mask = FALSE,
trapsClustered = FALSE
)
An integer of either 2 (the default) or that defines what dimensional format the encounter history data are in.
Either "binomial"
or "poisson"
. Default is
"binomial"
.
A logical value indicating whether the scaling parameter ('sigma') is sex-specific
A logical value indicating whether a habitat mask will be
used. Default is FALSE
.
A logical value indicating if traps are clustered in arrays across the sampling area.
A nimbleCode
object from the nimble
package.
This function provides templates that could be copied and easily modified to include further model complexity such as covariates explaining detection probability. The models include different encounter probability distributions, sex-specific scaling parameters, and habitat masking.
# get model for 2D encounter data, binomial encounter distribution,
# non-sex-specific scaling parameter, and no habitat mask
scr_model = get_classic(dim_y = 2,enc_dist = "binomial",sex_sigma = FALSE,
hab_mask = FALSE,trapsClustered = FALSE)
# inspect model
scr_model
#> {
#> p0 ~ dunif(0, 1)
#> sigma ~ dunif(0, sigma_upper)
#> psi ~ dunif(0, 1)
#> for (i in 1:M) {
#> z[i] ~ dbern(psi)
#> s[i, 1] ~ dunif(x_lower, x_upper)
#> s[i, 2] ~ dunif(y_lower, y_upper)
#> dist[i, 1:J] <- sqrt((s[i, 1] - X[1:J, 1])^2 + (s[i,
#> 2] - X[1:J, 2])^2)
#> p[i, 1:J] <- p0 * exp(-dist[i, 1:J]^2/(2 * sigma^2))
#> }
#> for (i in 1:n0) {
#> for (j in 1:J) {
#> y[i, j] ~ dbin(p[i, j], K)
#> }
#> }
#> for (i in (n0 + 1):M) {
#> zeros[i] ~ dbern((1 - prod(1 - p[i, 1:J])^K) * z[i])
#> }
#> N <- sum(z[1:M])
#> D <- N/A
#> }