This function fits the dynamic occupancy model of MacKenzie et al. (2003).

stan_colext(
  psiformula = ~1,
  gammaformula = ~1,
  epsilonformula = ~1,
  pformula = ~1,
  data,
  prior_intercept_psi = logistic(0, 1),
  prior_coef_psi = logistic(0, 1),
  prior_intercept_gamma = logistic(0, 1),
  prior_coef_gamma = logistic(0, 1),
  prior_intercept_eps = logistic(0, 1),
  prior_coef_eps = logistic(0, 1),
  prior_intercept_det = logistic(0, 1),
  prior_coef_det = logistic(0, 1),
  prior_sigma = gamma(1, 1),
  log_lik = TRUE,
  ...
)

Arguments

psiformula

Right-hand sided formula for the initial probability of occupancy at each site

gammaformula

Right-hand sided formula for colonization probability

epsilonformula

Right-hand sided formula for extinction probability

pformula

Right-hand sided formula for detection probability

data

A unmarkedMultFrame object

prior_intercept_psi

Prior distribution for the intercept of the psi (initial occupancy probability) model; see ?priors for options

prior_coef_psi

Prior distribution for the regression coefficients of the psi model

prior_intercept_gamma

Prior distribution on intercept for colonization probability

prior_coef_gamma

Prior distribution on regression coefficients for colonization probability

prior_intercept_eps

Prior distribution on intercept for extinction probability

prior_coef_eps

Prior distribution on regression coefficients for extinction probability

prior_intercept_det

Prior distribution for the intercept of the detection probability model

prior_coef_det

Prior distribution for the regression coefficients of the detection model

prior_sigma

Prior distribution on random effect standard deviations

log_lik

If TRUE, Stan will save pointwise log-likelihood values in the output. This can greatly increase the size of the model. If FALSE, the values are calculated post-hoc from the posteriors

...

Arguments passed to the stan call, such as number of chains chains or iterations iter

Value

ubmsFitColext object describing the model fit.

References

MacKenzie DI, Nicholas JD, Hines JE, Knutson MG, Franklin AB. 2003. Ecology 84: 2200-2207.

Examples

# \donttest{
data(frogs)
umf <- formatMult(masspcru)
umf@y[umf@y > 1] <- 1 #convert counts to presence/absence
umf <- umf[1:100,] #Use only 100 sites

fit_frog <- stan_colext(~1, ~1, ~1, ~1, umf, chains=3, iter=300)
#> 
#> SAMPLING FOR MODEL 'colext' NOW (CHAIN 1).
#> Chain 1: 
#> Chain 1: Gradient evaluation took 0.002044 seconds
#> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 20.44 seconds.
#> Chain 1: Adjust your expectations accordingly!
#> Chain 1: 
#> Chain 1: 
#> Chain 1: Iteration:   1 / 300 [  0%]  (Warmup)
#> Chain 1: Iteration:  30 / 300 [ 10%]  (Warmup)
#> Chain 1: Iteration:  60 / 300 [ 20%]  (Warmup)
#> Chain 1: Iteration:  90 / 300 [ 30%]  (Warmup)
#> Chain 1: Iteration: 120 / 300 [ 40%]  (Warmup)
#> Chain 1: Iteration: 150 / 300 [ 50%]  (Warmup)
#> Chain 1: Iteration: 151 / 300 [ 50%]  (Sampling)
#> Chain 1: Iteration: 180 / 300 [ 60%]  (Sampling)
#> Chain 1: Iteration: 210 / 300 [ 70%]  (Sampling)
#> Chain 1: Iteration: 240 / 300 [ 80%]  (Sampling)
#> Chain 1: Iteration: 270 / 300 [ 90%]  (Sampling)
#> Chain 1: Iteration: 300 / 300 [100%]  (Sampling)
#> Chain 1: 
#> Chain 1:  Elapsed Time: 4.521 seconds (Warm-up)
#> Chain 1:                1.682 seconds (Sampling)
#> Chain 1:                6.203 seconds (Total)
#> Chain 1: 
#> 
#> SAMPLING FOR MODEL 'colext' NOW (CHAIN 2).
#> Chain 2: 
#> Chain 2: Gradient evaluation took 0.001014 seconds
#> Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 10.14 seconds.
#> Chain 2: Adjust your expectations accordingly!
#> Chain 2: 
#> Chain 2: 
#> Chain 2: Iteration:   1 / 300 [  0%]  (Warmup)
#> Chain 2: Iteration:  30 / 300 [ 10%]  (Warmup)
#> Chain 2: Iteration:  60 / 300 [ 20%]  (Warmup)
#> Chain 2: Iteration:  90 / 300 [ 30%]  (Warmup)
#> Chain 2: Iteration: 120 / 300 [ 40%]  (Warmup)
#> Chain 2: Iteration: 150 / 300 [ 50%]  (Warmup)
#> Chain 2: Iteration: 151 / 300 [ 50%]  (Sampling)
#> Chain 2: Iteration: 180 / 300 [ 60%]  (Sampling)
#> Chain 2: Iteration: 210 / 300 [ 70%]  (Sampling)
#> Chain 2: Iteration: 240 / 300 [ 80%]  (Sampling)
#> Chain 2: Iteration: 270 / 300 [ 90%]  (Sampling)
#> Chain 2: Iteration: 300 / 300 [100%]  (Sampling)
#> Chain 2: 
#> Chain 2:  Elapsed Time: 4.167 seconds (Warm-up)
#> Chain 2:                1.019 seconds (Sampling)
#> Chain 2:                5.186 seconds (Total)
#> Chain 2: 
#> 
#> SAMPLING FOR MODEL 'colext' NOW (CHAIN 3).
#> Chain 3: 
#> Chain 3: Gradient evaluation took 0.00096 seconds
#> Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 9.6 seconds.
#> Chain 3: Adjust your expectations accordingly!
#> Chain 3: 
#> Chain 3: 
#> Chain 3: Iteration:   1 / 300 [  0%]  (Warmup)
#> Chain 3: Iteration:  30 / 300 [ 10%]  (Warmup)
#> Chain 3: Iteration:  60 / 300 [ 20%]  (Warmup)
#> Chain 3: Iteration:  90 / 300 [ 30%]  (Warmup)
#> Chain 3: Iteration: 120 / 300 [ 40%]  (Warmup)
#> Chain 3: Iteration: 150 / 300 [ 50%]  (Warmup)
#> Chain 3: Iteration: 151 / 300 [ 50%]  (Sampling)
#> Chain 3: Iteration: 180 / 300 [ 60%]  (Sampling)
#> Chain 3: Iteration: 210 / 300 [ 70%]  (Sampling)
#> Chain 3: Iteration: 240 / 300 [ 80%]  (Sampling)
#> Chain 3: Iteration: 270 / 300 [ 90%]  (Sampling)
#> Chain 3: Iteration: 300 / 300 [100%]  (Sampling)
#> Chain 3: 
#> Chain 3:  Elapsed Time: 3.416 seconds (Warm-up)
#> Chain 3:                1.408 seconds (Sampling)
#> Chain 3:                4.824 seconds (Total)
#> Chain 3: 
#> Warning: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
#> Running the chains for more iterations may help. See
#> https://mc-stan.org/misc/warnings.html#bulk-ess
#> Warning: Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
#> Running the chains for more iterations may help. See
#> https://mc-stan.org/misc/warnings.html#tail-ess
# }