This function fits the single season occupancy model of MacKenzie et al. (2002).

stan_occu(formula, data, ...)

Arguments

formula

Double right-hand side formula describing covariates of detection and occupancy in that order

data

A unmarkedFrameOccu object

...

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

Value

ubmsFitOccu object describing the model fit.

References

MacKenzie DI, Nichols JD, Lachman GB, Droege S, Royle JA, Langtimm CA. 2002. Estimating site occupancy rates when detection probabilities are less than one. Ecology 83: 2248-2255.

See also

occu, unmarkedFrameOccu

Examples

# \donttest{ data(frogs) pferUMF <- unmarkedFrameOccu(pfer.bin) #Add some covariates siteCovs(pferUMF) <- data.frame(cov1=rnorm(numSites(pferUMF))) #Fit model (fm <- stan_occu(~1~cov1, pferUMF, chains=3, iter=300))
#> #> SAMPLING FOR MODEL 'single_season' NOW (CHAIN 1). #> Chain 1: #> Chain 1: Gradient evaluation took 0.000103 seconds #> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 1.03 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: 0.816916 seconds (Warm-up) #> Chain 1: 0.477408 seconds (Sampling) #> Chain 1: 1.29432 seconds (Total) #> Chain 1: #> #> SAMPLING FOR MODEL 'single_season' NOW (CHAIN 2). #> Chain 2: #> Chain 2: Gradient evaluation took 0.000119 seconds #> Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 1.19 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: 1.09817 seconds (Warm-up) #> Chain 2: 0.246651 seconds (Sampling) #> Chain 2: 1.34482 seconds (Total) #> Chain 2: #> #> SAMPLING FOR MODEL 'single_season' NOW (CHAIN 3). #> Chain 3: #> Chain 3: Gradient evaluation took 0.000104 seconds #> Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 1.04 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: 0.901646 seconds (Warm-up) #> Chain 3: 0.501258 seconds (Sampling) #> Chain 3: 1.4029 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 #> http://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 #> http://mc-stan.org/misc/warnings.html#tail-ess
#> Warning: Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details.
#> #> Call: #> stan_occu(formula = ~1 ~ cov1, data = pferUMF, chains = 3, iter = 300) #> #> Occupancy (logit-scale): #> Estimate SD 2.5% 97.5% n_eff Rhat #> (Intercept) 11.93 5.87 2.60 24.97 121 1.03 #> cov1 -1.35 3.72 -9.25 5.08 200 1.03 #> #> Detection (logit-scale): #> Estimate SD 2.5% 97.5% n_eff Rhat #> -1.92 0.18 -2.3 -1.56 154 1.02 #> #> LOOIC: 259.804
# }