The single-season occupancy model of MacKenzie et al. (2002), as Kéry and Royle present it in chapter 10 of Applied Hierarchical Modeling, fit with unmarked to the willow tit table in eco. A simulator at the top shows why repeated surveys are what separate occupancy from detection.
Published
November 20, 2026
A site either holds a species or it does not, and a survey either finds it or does not. Those are two different coin flips, and one survey per site cannot tell them apart: an undetected species and an absent species produce the same zero. The single-season occupancy model (MacKenzie et al. 2002; Kéry and Royle 2016, chapter 10) separates the two by surveying each site more than once within a window short enough that the true state cannot change. This page walks through that model on one eco table, from fetch to goodness of fit, with unmarked doing the fitting.
WarningHow these vignettes were made
These vignettes, including the choice of tables, the analysis design, the code and the writing, were produced largely by Claude (Anthropic), working from a task specification and reviewed by a psychometrician who is new to ecological modelling. Treat the methodological choices and interpretations accordingly, check the code on each page directly if you are relying on the numbers, and open an issue if something looks wrong.
Try it first
Sites are occupied with probability \(\psi\). Each of \(J\) surveys of an occupied site detects the species with probability \(p\); surveys of an empty site never do. Drag the sliders and watch the amber strips: those are occupied sites the surveys never found, which are the whole reason the model exists.
detected not detected strip outline: occupied, never detected
True occupancy (share of sites with z = 1)
Naive occupancy (share with any detection)
Expected naive occupancy, ψ[1 − (1 − p)J]
Cumulative detection, 1 − (1 − p)J
P(occupied | all J surveys zero)
Occupied sites never detected
Each strip is one site, its cells the J surveys in order. Hover a strip for its history. The conditional probability is ψ(1 − p)J / [ψ(1 − p)J + 1 − ψ].
Three things to notice. Naive occupancy converges on \(\psi[1-(1-p)^J]\), not on \(\psi\), and the gap closes only as \(J\) grows or \(p\) is high. The conditional probability that an all-zero site is occupied is what the model will later hand back for every undetected site, and it is small only when \((1-p)^J\) is small. And at \(J = 1\) the simulator admits that it cannot distinguish a common, cryptic species from a rare, conspicuous one.
The model
Site \(i\) carries a latent state \(z_i \in \{0, 1\}\),
\[
z_i \sim \text{Bernoulli}(\psi_i),
\]
and survey \(j\) of site \(i\) returns a detection \(y_{ij}\) that is possible only when the site is occupied,
Covariates enter on the logit scale at the level where they vary: \(\text{logit}(\psi_i) = \mathbf{x}_i^\top \boldsymbol{\beta}\) for things fixed at a site, \(\text{logit}(p_{ij}) = \mathbf{w}_{ij}^\top \boldsymbol{\alpha}\) for things that change between surveys. Summing \(z_i\) out gives the marginal likelihood of one site’s detection history \(\mathbf{y}_i\), a zero-inflated product of Bernoullis:
A site with at least one detection contributes only the first term, so it is known to be occupied and its surveys inform \(p\) alone. An all-zero site contributes \(\psi_i (1-p_{i\cdot})^{J} + 1 - \psi_i\), the mixture of “occupied and missed every time” with “empty”. Replicate surveys are what make the two terms separable: among the detected sites, the pattern of ones and zeros across surveys estimates \(p\) with no reference to \(\psi\), and once \(p\) is pinned the share of all-zero sites that must be occupied follows. With \(J = 1\) there is no within-site pattern, the likelihood depends on \(\psi p\) only, and the model is unidentified.
The data
The table is kery_2008_willowtit_occ: the Swiss breeding bird survey’s willow tit data that ship with unmarked and that Kéry and Royle use for the MHB examples in chapters 10 and 11. There are 237 one-km² quadrats, each surveyed up to three times in one breeding season, with elevation, forest cover and transect length at the quadrat and the survey date and intensity at each visit. All covariates are standardised in the source file. Reads are pinned to eco version 10 so the numbers on this page do not move when the warehouse grows.
One row per survey. The unit_ columns are constant within a site and will become unmarked’s site covariates; the obs_ columns vary by survey and become its observation covariates. occasion is the survey index within the single primary period, and the standard requires a row to exist exactly when a survey happened.
table(table(d$unit))
1 2 3
2 42 193
nrow(d)
[1] 665
237*3-nrow(d)
[1] 46
Forty-six site-surveys were never made, so forty-two quadrats have two rows and two have one. They have no rows at all rather than rows with y = 0, because a survey that did not happen is not evidence of absence. This matters for the likelihood above: an all-zero history over two surveys contributes \(\psi (1-p)^2 + 1 - \psi\), while the same site padded to three zeros would contribute \(\psi (1-p)^3 + 1 - \psi\) and claim an extra miss that never occurred. When the long table is widened those cells must become NA, which unmarked treats as not surveyed. eco_to_unmarked() does exactly that.
The prefixes are gone because the frame already encodes the level: siteCovs() holds what was unit_*, obsCovs() holds what was obs_*, one row per site-by-survey cell in the frame’s order. Naive occupancy is the share of sites with at least one detection.
Y <-getY(umf)naive <-mean(rowSums(Y, na.rm =TRUE) >0)naive
[1] 0.333
Fit
occu() takes a double right-hand-side formula: detection first, occupancy second. Three models: the null model; one that puts elevation and forest on \(\psi\) with a quadratic in elevation, since willow tits are a subalpine bird and should peak at mid elevation; and one that adds survey date and intensity on \(p\).
Call:
occu(formula = ~date_doy_std + ivel_std ~ elev + I(elev^2) +
forest, data = umf)
Occupancy (logit-scale):
Estimate SE z P(>|z|)
(Intercept) -0.218 0.279 -0.782 4.34e-01
elev 1.994 0.311 6.412 1.44e-10
I(elev^2) -1.092 0.274 -3.987 6.68e-05
forest 0.848 0.234 3.626 2.87e-04
Detection (logit-scale):
Estimate SE z P(>|z|)
(Intercept) 1.2451 0.192 6.495 8.29e-11
date_doy_std 0.0978 0.115 0.852 3.94e-01
ivel_std 0.1362 0.222 0.613 5.40e-01
AIC: 436
Number of sites: 237
Occupancy rises steeply with elevation, turns over above the mean (the quadratic term is negative), and is higher in forested quadrats. Neither detection covariate earns its place: the AIC gain from m1 to m2 is below what two free parameters cost, and both coefficients sit well inside their standard errors. The null model’s constants are the ones the simulator’s sliders correspond to.
backTransform(m0, "state")
Backtransformed linear combination(s) of Occupancy estimate(s)
Estimate SE LinComb (Intercept)
0.34 0.0313 -0.665 1
Transformation: logistic
backTransform(m0, "det")
Backtransformed linear combination(s) of Detection estimate(s)
Estimate SE LinComb (Intercept)
0.79 0.0289 1.32 1
Transformation: logistic
Interpret
Naive against estimated. Under the null model \(\hat\psi\) = 0.34 against a naive 0.33, a correction of only 0.01. That is not a failure of the method. With \(\hat p\) = 0.79 per survey the cumulative detection over three visits is \(1 - (1 - \hat p)^3\) = 0.99, so the surveys very nearly census the occupied quadrats and there is little to correct. Set the simulator to \(p\) = 0.8 and \(J\) = 3 to see the same thing; then set \(p\) = 0.3 to see what this analysis would look like for a cryptic species.
Conditional occupancy of the undetected sites. For an all-zero site the model’s posterior that it is occupied is \(\psi(1-p)^J / [\psi(1-p)^J + 1 - \psi]\), which under the null model is 0.005 for a site with three surveys. Under m2 each site has its own \(\psi_i\) and \(p_{ij}\), and ranef() returns the site-level posterior of \(z_i\).
re <-ranef(m2)z_hat <-bup(re, stat ="mean") # posterior mean of z_iundetected <-rowSums(Y, na.rm =TRUE) ==0summary(z_hat[undetected])
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.58e-05 3.92e-04 1.75e-03 8.45e-03 1.37e-02 8.25e-02
sum(undetected)
[1] 158
Every detected site has \(z_i = 1\) with certainty. The undetected sites range from essentially zero to about 0.08, with the highest values at mid-elevation forested quadrats where \(\psi_i\) is high, and at the quadrats with only one or two surveys, where \((1-p)^J\) is larger.
Figure 1: Posterior probability that an undetected quadrat is occupied, against its elevation. Shape marks how many surveys it received.
Finite-sample against model occupancy. Two different questions hide behind “how many quadrats are occupied”. The model parameter \(\psi\) is the probability a quadrat like these is occupied; the finite-sample quantity is how many of these 237 quadrats are. The second is the sum of the \(z_i\), estimated by summing the posterior means, and its uncertainty is smaller because the detected sites contribute no uncertainty at all.
Figure 2: Predicted occupancy against elevation at mean forest cover, with the 95% confidence band. Ticks along the top are quadrats with a detection; along the bottom, quadrats without.
Check
The MacKenzie and Bailey (2004) test compares the observed count of each detection history (000, 001, …, 111, with the two- and one-survey cohorts separately) against what the fitted model expects, and bootstraps the Pearson statistic from the model to get its reference distribution. AICcmodavg::mb.gof.test() does it on an unmarked fit.
The test rejects, with \(\hat c\) = 3.6. Two cells carry it: 111 is observed well above its expectation, and 100 at about three times its expectation, while the mixed histories 011 and 110 fall short. That pattern is the signature of detection heterogeneity the covariates have not captured. Some quadrats are easy, the bird is found every time, and some are hard, so the histories bunch at the extremes rather than spreading binomially. The excess of 100 could also be a closure failure: a bird present and singing on the first visit that had moved on by the second.
Neither violation is harmless for \(\hat\psi\). Unmodelled heterogeneity in \(p\) means the all-zero sites are disproportionately the hard ones, where \((1-p)^J\) is larger than the model thinks, so \(\hat\psi\) is biased low. Closure failure does the opposite: \(\psi\) becomes the probability that a quadrat was used at some point during the season, which is larger than the probability it was occupied throughout, so \(\hat\psi\) overstates the quantity most people mean. Here the two may partly cancel, and with \(\hat p\) near 0.8 the damage to \(\hat\psi\) is bounded either way; a quasi-likelihood fix multiplies the standard errors by \(\sqrt{\hat c}\) = 1.9. The constructive fixes are a detection covariate that captures the heterogeneity, a finite-mixture detection model, or a dynamic model that drops the closure assumption.
The same model across the corpus
One table is a tutorial. The point of a warehouse is that the same six lines run over every table of the same shape, so this section fits the null model \(\psi(\cdot)\,p(\cdot)\) to every species in every site-level detection or count table in eco version 10 and asks three questions of each fit: how far \(\hat\psi\) sits from naive occupancy, whether the estimate is at a boundary, and whether the MacKenzie and Bailey test rejects. The tables are chosen by rule from eco_metadata(), not by name: site units, a detection or count response, at least two occasions. Designs the model does not describe (multi-scale eDNA, false-positive and two-scale co-occurrence tables) are excluded by name, each with its reason, and the tables over the 100 MB that Redivis serves without a login are held back for now; both lists are at the end of this section. The fits take most of an hour because of the bootstrap, so they live in a companion script, occupancy_corpus_compute.R, and the page reads its cache. Multi-season tables contribute the primary period with the most surveys; count tables are collapsed to detection; a species never detected in that period, or surveyed once per site, is skipped, since the null model has nothing to fit or cannot separate \(\psi\) from \(p\).
corpus <-readRDS("occupancy_data/occupancy_corpus.rds")# Tables withdrawn since the sweep (releases/withdrawals.csv) are dropped from# the cache: obrist_2024_gooseisland_birds_count, pending CARE review (#150).withdrawn <-"obrist_2024_gooseisland_birds_count"corpus$fits <- corpus$fits[!corpus$fits$table %in% withdrawn, ]corpus$corpus_tables <- corpus$corpus_tables[!corpus$corpus_tables$table %in% withdrawn, ]fits <- corpus$fitsfits$correction <- fits$psi - fits$naivefits$boundary <-!fits$converged | fits$psi >0.995| fits$psi <0.005| fits$p <0.005# The test's cohort table has 2^J cells. Past ten surveys the expected counts# are tiny and the statistic degenerates (the marten table, J = 24, returns a# c-hat in the billions), so the test is only read where J <= 10.fits[fits$J >10, c("chisq", "gof_p", "c_hat")] <-NAfits$reject <-!is.na(fits$gof_p) & fits$gof_p <0.05fits$floor <-ifelse(fits$sample_floor =="meets", "meets floor", "below floor")
Of the 84 tables the rule selects, 12 are excluded by design and 8 held back for size, and the rule on one survey per site removes 2 more entirely (frimpong_2017_newriver_dynocc and sandercock_2022_norway_plants_comm): in the period each contributes, most sites were surveyed once for each species.
The null model by taxon group. Medians and the test are over the fits not at a boundary.
group
tables
species
at boundary
median p
median psi
median psi - naive
GOF rejects
median c-hat
Invertebrates
14
509
20%
0.14
0.57
0.11
34 / 278
1.19
Birds
13
505
17%
0.39
0.41
0.06
127 / 376
1.38
Fish
5
354
21%
0.39
0.61
0.08
30 / 278
0.98
Multiple
4
120
56%
0.07
0.36
0.03
9 / 33
0.82
Mammals
16
90
26%
0.20
0.31
0.06
17 / 58
1.02
Amphibians
4
23
0%
0.47
0.36
0.04
6 / 23
1.61
Reptiles
5
6
0%
0.50
0.40
0.02
1 / 5
1.44
Plants
1
1
0%
0.42
0.18
0.03
0 / 1
0.90
Across 1608 species fits in 62 tables, 352 are at a boundary, with \(\hat\psi\) pinned to 1 or \(\hat p\) to 0. A good share of those (143) are species detected at fewer than one site in twenty, where a handful of detections cannot say whether the species is rare or merely hard to see. The rest gather in a few designs: the extended Aldabra reef-fish survey, with two visits per site and 38 of 144 species at the boundary; the West Virginia camera grids, where the occasion is a single camera-day and the per-day \(\hat p\) for most species is under 0.01 (26 of 35 species in the Monongahela table); and the Belgian carabid pitfalls, with three visits and low catch rates. 16 tables, most of them small community surveys of reef fish, odonates and bumblebees, are below the standard’s sample floor. Among the well-behaved fits the median correction \(\hat\psi - \text{naive}\) is 0.06, with the middle 80% of species between 0.00 and 0.94. That upper decile is species with \(\hat p\) just above the boundary rule, and 54 of its 87 fits come from two tables: the UK woodland beetle pitfalls and the Berchtesgaden wild bees, where the median \(\hat p\) is 0.13 and 0.01. Those fits are technically interior and substantively the same failure as the boundary ones.
The group table says the corpus has changed character. Birds were most of the version 2 corpus; now invertebrates and fish together outnumber them. Invertebrates are detected far less often than birds (median \(\hat p\) 0.14 against 0.39) and carry about twice the correction; fish are detected as often as birds but estimated present at more of the sites. Whether that is the taxa or the designs that survey them (pitfalls and pan traps visited two or three times, against point counts and territory mapping) the null model cannot say, and the next section’s covariate is a first attempt to tell them apart.
Figure 3: Estimated against naive occupancy for every species fit, one panel per taxon group. Colour is the estimated per-survey detection probability; open triangles are tables below the sample floor; points on the top edge are boundary fits. Hover a point for the species.
The picture is the simulator’s expected-naive line read backwards. Species with high \(\hat p\) sit on the diagonal; the correction grows as \(\hat p\) falls, and below about \(p = 0.2\) with three surveys the all-zero sites can no longer be told apart from empty ones and the fit slides up the top edge. The bird panel is mostly the first regime and the invertebrate panel mostly the second. The below-floor tables show the same failure from the other direction: ten or twenty sites cannot pin \(\psi\) down whatever \(p\) is.
Figure 4: The overdispersion estimate from the MacKenzie and Bailey test for every fit it could be run on (ten or fewer surveys, not at a boundary). Values above 10 are drawn at 10. The dashed line is 1, where the null model fits.
The test rejects at the 5% level for 26% of the well-behaved fits, with a median \(\hat c\) of 1.2. The share tracks sample size and detection as a power calculation would predict: in the MHB community table, with 266 quadrats and a median \(\hat p\) above 0.6, the test rejects for 68% of species, while in the low-\(p\) invertebrate tables it rarely has the power to reject anything. A quiet test there is not evidence of fit. That the willow tit’s \(\hat c\) of 3.1 is not unusual among the well-sampled bird tables is the useful lesson: the constant-\(p\) model is a starting point, and the detection heterogeneity it leaves behind is the norm in field data, not a feature of one table. The remedies are the ones listed above, and the covariates to try are already in the tables’ unit_ and obs_ columns.
Every table in the sweep (62), and the ones left out
table
species
group
sites
J
median p
median psi - naive
at boundary
GOF rejects
floor
kery_2014_mhb_comm
145
Birds
266
3.0
0.65
0.01
23
83 / 127
meets floor
koester_2023_aldabra_reeffishext_count
144
Fish
21
2.0
0.06
0.85
38
6 / 106
below floor
bradferlawrence_2025_ukwood_beetle_comm
115
Invertebrates
60
5.0
0.11
0.14
9
9 / 106
meets floor
barea_2021_sierranevada_butterfly_count
90
Invertebrates
21
13.0
0.16
0.08
9
0 / 0
below floor
margenau_2021_rowsongbirds_nmix
90
Birds
216
2.0
0.22
0.28
19
4 / 71
meets floor
maihoff_2023_berchtesgaden_bees_count
83
Invertebrates
33
5.0
0.02
0.90
9
10 / 74
meets floor
koester_2023_aldabra_reeffish_count
73
Fish
21
3.0
0.38
0.13
21
5 / 52
below floor
stallings_2025_gulfreefs_count
70
Fish
14
4.0
0.35
0.07
13
6 / 57
below floor
sullivan_2026_powdermill_count
70
Birds
101
2.0
0.20
0.52
10
7 / 60
meets floor
peer_2014_bmsil_butterfly_count
64
Invertebrates
27
17.0
0.09
0.11
16
0 / 0
meets floor
henry_2020_karoo_birds_comm
63
Birds
61
18.0
0.10
0.11
18
0 / 0
meets floor
bradferlawrence_2025_ukwood_bird_comm
54
Birds
125
3.0
0.37
0.07
3
21 / 51
meets floor
fukaya_2022_kasumigaura_fish_mb
50
Fish
50
3.0
0.63
0.02
2
9 / 48
meets floor
clipp_2024_wvprivate_comm
47
Multiple
146
63.0
0.01
0.73
27
0 / 0
meets floor
kyaw_2024_myanmar_mamm_comm
46
Mammals
518
5.0
0.11
0.10
12
5 / 34
meets floor
peters_2026_carabid_pitfall_count
42
Invertebrates
225
3.0
0.01
0.93
24
1 / 18
meets floor
work_2026_ocala_odonatenymphs_count
36
Invertebrates
16
2.0
0.14
0.72
13
2 / 23
below floor
clipp_2024_monongahela_comm
35
Multiple
129
9.0
0.00
0.97
26
3 / 9
meets floor
lebeuftaylor_2026_boreal_edges_aru_comm
34
Birds
564
3.0
0.36
0.05
3
0 / 31
meets floor
glorioso_2025_atchafalaya_ves
32
Multiple
66
6.0
0.04
0.69
12
6 / 20
meets floor
work_2026_ocala_odonates_comm
28
Invertebrates
16
2.0
0.11
0.78
14
0 / 14
below floor
palacio_2020_pampasbirds_comm
19
Birds
10
5.0
0.18
0.25
7
2 / 12
below floor
mctigue_2023_nwarkansas_comm
18
Mammals
285
6.0
0.19
0.10
6
6 / 12
meets floor
lafferty_2024_estuaryfish_mb
17
Fish
14
2.0
0.72
0.00
2
4 / 15
below floor
peters_2026_carabid_emergence_count
17
Invertebrates
99
3.0
0.17
0.41
3
5 / 14
meets floor
boone_2023_minnesota_bombus_count
15
Invertebrates
25
5.0
0.58
0.02
1
7 / 14
below floor
dettling_2021_marin_riparian_count
14
Birds
175
2.0
0.37
0.17
1
5 / 13
meets floor
doser_2022_hbef_trends_dynocc
12
Birds
373
3.0
0.53
0.06
0
2 / 12
meets floor
johnson_2023_tweedsmuir_bombus_count
10
Invertebrates
26
2.0
0.15
0.69
3
0 / 7
below floor
hamer_2024_hungary_amph_comm
9
Amphibians
100
3.0
0.36
0.06
0
4 / 9
meets floor
price_2018_mtr_salamanders_count
7
Amphibians
23
4.0
0.65
0.01
0
0 / 7
below floor
addis_2026_rmap_amph_dynocc
6
Amphibians
313
4.0
0.46
0.03
0
2 / 6
meets floor
nowicki_2019_sharkbay_count
6
Multiple
10
9.5
0.28
0.03
2
0 / 4
below floor
galvez_2021_araucania_comm
5
Mammals
180
11.0
0.36
0.01
0
0 / 0
meets floor
bradferlawrence_2025_ukwood_mammal_comm
4
Mammals
100
4.0
0.53
0.02
0
3 / 4
meets floor
dezeeuw_2024_nl_waterbeetle_nmix
4
Invertebrates
85
2.0
0.72
0.04
0
0 / 4
meets floor
malhotra_2021_loslagos_comm
4
Mammals
48
10.0
0.23
0.02
0
3 / 4
meets floor
inbo_2026_flanders_dragonfly_count
3
Invertebrates
16
2.0
0.70
0.06
0
0 / 3
meets floor
ahizi_2021_civ_crocodylians_occ
2
Reptiles
42
5.0
0.82
0.00
0
0 / 2
meets floor
blount_2025_neturkiye_carniv_count
2
Mammals
216
10.0
0.13
0.28
1
0 / 1
meets floor
goldingay_2022_richmond_mammals_dynocc
2
Mammals
34
3.0
0.26
0.24
0
0 / 2
meets floor
armstrong_2024_hydrilla_dynocc
1
Plants
504
4.0
0.42
0.03
0
0 / 1
meets floor
bhattacharya_2022_himachal_bear_occ
1
Mammals
67
37.0
0.05
0.11
0
0 / 0
meets floor
bison_2024_montblanc_hare_dynocc
1
Mammals
45
91.0
0.01
0.78
1
0 / 0
meets floor
blount_2025_neturkiye_lynx_occ
1
Mammals
216
10.0
0.07
0.24
0
0 / 1
meets floor
bruce_2021_wisconsin_monarch_nmix
1
Invertebrates
60
3.0
0.71
0.02
0
0 / 1
meets floor
burgar_2018_alberta_fisher_count
1
Mammals
64
64.0
0.04
0.42
1
0 / 0
meets floor
evans_2021_maine_marten_dynocc
1
Mammals
193
24.0
0.12
0.03
0
0 / 0
meets floor
hartley_2024_cpraealtus_occ
1
Reptiles
113
5.0
0.23
0.11
0
1 / 1
meets floor
hepler_2018_serengeti_gazelle_occ
1
Mammals
194
34.0
0.15
0.28
1
0 / 0
meets floor
kery_2005_mallard_count
1
Birds
235
3.0
0.66
0.01
0
0 / 1
meets floor
kery_2008_willowtit_occ
1
Birds
237
3.0
0.79
0.01
0
1 / 1
meets floor
kery_2010_crossbill_dynocc
1
Birds
266
3.0
0.69
0.02
0
1 / 1
meets floor
knape_2018_shoveler_count
1
Birds
50
10.0
0.67
0.00
0
1 / 1
meets floor
koetke_2024_jprf_moose_count
1
Mammals
72
91.0
0.02
0.39
1
0 / 0
meets floor
leone_2019_minnesota_monarch_nmix
1
Invertebrates
20
3.0
0.47
0.15
1
0 / 0
below floor
samek_2024_racerunner_occ
1
Reptiles
100
3.0
0.23
0.27
0
0 / 1
meets floor
schank_2015_tapir_occ
1
Mammals
22
45.0
0.03
0.10
0
0 / 0
below floor
smith_2024_florida_tegu_dynocc
1
Reptiles
77
19.0
0.15
0.03
0
0 / 0
meets floor
teitsworth_2026_necturus_dynocc
1
Amphibians
93
4.0
0.55
0.02
0
0 / 1
meets floor
tleimat_2023_ecuador_capuchin_occ
1
Mammals
21
28.0
0.13
0.04
0
0 / 0
below floor
yadav_2022_rapti_gharial_count
1
Reptiles
18
3.0
0.98
0.00
0
0 / 1
below floor
table
status
reason
allen_2021_nj_lanternfly_edna
excluded
multi-scale eDNA qPCR with a paired visual survey
chambert_2018_plethodon_fpocc
excluded
two species with misidentification; needs a false-positive model
dougherty_2016_rustycrayfish_edna
excluded
multi-scale eDNA qPCR with trap; occasions mix methods
kleiven_2020_varanger_dynocc
excluded
two spatial scales and 304 occasions; a co-occurrence design
lafferty_2024_tidewatergoby_edna
excluded
multi-scale, multi-method eDNA (qPCR and metabarcoding)
sandercock_2022_norway_insects_edna
excluded
multi-scale eDNA metabarcoding
smith_2019_greatbasin_csf_edna
excluded
multi-scale eDNA (watershed > site > sample); the unit is not the site the model wants
multi-scale (reach > site > survey) with two gears
tomke_2025_hellbender_edna
excluded
multi-scale eDNA (site > filter > qPCR replicate)
whittington_2015_banff_tracks_comm
excluded
multi-scale (cell > segment > repeat walk) with Markovian detection
ziolkowski_2026_bbs_count
excluded
18 GB, 110 M rows; too large for a per-species sweep (the BCR 15 pilots stand in for BBS)
frimpong_2017_newriver_dynocc
no fit
one survey per site per species in the period used
sandercock_2022_norway_plants_comm
no fit
one survey per site per species in the period used
neon_2026_carabids_count
skipped
529 MiB; large tables held back for now (run with –big)
neon_2026_landbirds_count
skipped
931 MiB; large tables held back for now (run with –big)
neon_2026_smallmammals_count
skipped
369 MiB; large tables held back for now (run with –big)
nina_2026_norway_pollinator_count
skipped
531 MiB; large tables held back for now (run with –big)
rooney_2025_snapshotusa_comm
skipped
617 MiB; large tables held back for now (run with –big)
vanklink_2025_wijster_carabid_count
skipped
136 MiB; large tables held back for now (run with –big)
ziolkowski_2026_bbs_bcr15_block
skipped
214 MiB; large tables held back for now (run with –big)
ziolkowski_2026_bbs_bcr15_stop
skipped
712 MiB; large tables held back for now (run with –big)
One covariate everywhere: effort on \(p\)
The null model’s ĉ says the constant-\(p\) assumption fails; the natural first covariate is the one every protocol records in some form, how hard the survey tried. 19 of the tables in the sweep carry it: camera nights, days or hours, minutes searched, the standardised survey intensity of the Swiss transects, trap-nights at a station, pitfall traps or cover tiles per visit, transect length. The units differ, so each is taken as standardised log effort (the two Kéry tables are standardised already) and the model becomes \(\psi(\cdot)\,p(\text{effort})\). The slope is then the change in logit \(p\) per standard deviation of log effort, a comparable number across protocols. The compute script fits it for every species in those tables, on the surveys with an effort value, and reruns the goodness-of-fit test. Three tables the metadata flags as having effort get no fit: in one the survey length is the same at every survey, and in two the flagged column is not effort.
Of the 416 species with a usable effort fit, 259 have a positive slope, 80 have an interval above zero and 7 an interval below it; the median slope is 0.16 on the logit scale, so one standard deviation more searching raises the odds of a detection by about 17%.
Figure 5: The effort slope on logit p for every species, with 95% intervals, grouped by table. Filled points have an interval that excludes zero. Hover for the species.
Three things stand out. The sign is mostly positive but the strength is not uniform: where effort varies a lot between surveys the slope is large and the fit improves sharply (the Hungarian pond searches, 3 to 114 minutes, with eight of nine species positive and clear of zero; the Arkansas cameras, 1 to 7 days, ten of twelve; the Myanmar camera network, half a day to ten days per occasion, 15 of 34 with a median \(\Delta\)AIC of 5.0), while where it barely varies (the Los Lagos stations, 67 to 80 trap-nights; the Chilean cameras, 2 to 5 nights) the slope is unidentified and the interval spans zero. The MHB community table is the instructive middle case: survey duration there runs from 105 to 420 minutes, yet the median slope is small and the AIC gain is nil. The territory-mapping protocol is designed so that every quadrat is covered completely on every visit, and the extra minutes go to terrain and pace rather than to a more thorough search, so for this protocol raw duration is not effort in the sense the model wants. The willow tit and mallard tables carry the package’s survey intensity, effort scaled to the route, which is the better variable and the reason those scripts kept it.
Two tables need a caveat before their slopes are read. In the West Virginia camera grids the occasion is one camera-day and nearly every occasion is a full 24 hours, so the slope rests on the few partial days at deployment and retrieval, and 53 of 82 species there are at a boundary under the null model and drop out of the figure. In the Berchtesgaden bee table the variable is whether a visit took one day or two, and the slope is negative for 63 of 71 species (median -0.88): two-day visits detect less. That is not what effort does. One possible reading, not yet checked against the deposit, is that a visit ran to a second day when the first was cut short, so the variable marks bad conditions rather than extra searching. It stays in the sweep as a reminder that a column called effort has to be read against the protocol before it goes into \(p\).
And one covariate does not fix the fit: ĉ falls for 57% of the species where both tests ran, but only 48% end up at or below 1.5, and the MHB median does not move. Most of the heterogeneity the null model’s test detected lives elsewhere, in the site, the observer, or the abundance behind a collapsed count, which is where the unit_ columns and a mixture on \(p\) come in.
Where this goes
Everything above changes by one line in the state or observation process, and eco carries a table for each.
Poisson state. Let \(N_i \sim \text{Poisson}(\lambda_i)\) with \(y_{ij} \mid N_i \sim \text{Binomial}(N_i, p)\) and the same table of counts fits the N-mixture model of chapter 6 (unmarked::pcount()). eco_to_unmarked() picks pcount when y goes beyond 0/1; kery_2014_mhb_comm is the MHB count table.
Markov state. Let \(z_{it}\) evolve across seasons by colonisation and extinction and the table with a period column fits the dynamic occupancy model of chapter 16 (unmarked::colext()), which is also the model that relaxes closure. kery_2010_crossbill_dynocc is the MHB crossbill table over nine years.
Species as random effects. Give every species in a community table its own \((\psi_k, p_k)\) drawn from a shared distribution and you have the community occupancy model of chapter 11. galvez_2021_araucania_comm and hamer_2024_hungary_amph_comm are community tables with one period and several surveys; eco_to_array() keeps the species dimension that eco_to_unmarked() refuses.
Reproducibility
Source: site/vignettes/occupancy.qmd and occupancy_corpus_compute.R in the eco repository; the corpus fits were run on 2026-11-04 with 100 bootstrap samples per test. Data were read with eco_set_version(10), so a later release of the warehouse does not change the page.
eco version 10 (Redivis eco v2.2, eco_meta v9.0, released 2026-11-04)
R 4.6.2; eco 0.1.0; unmarked 1.5.2; AICcmodavg 2.3.4
References
MacKenzie, D. I., Nichols, J. D., Lachman, G. B., Droege, S., Royle, J. A. and Langtimm, C. A. (2002). Estimating site occupancy rates when detection probabilities are less than one. Ecology 83, 2248–2255.
MacKenzie, D. I. and Bailey, L. L. (2004). Assessing the fit of site-occupancy models. JABES 9, 300–318.
Kéry, M. and Royle, J. A. (2016). Applied Hierarchical Modeling in Ecology, volume 1, chapters 10 and 11. Academic Press.
Fiske, I. and Chandler, R. (2011). unmarked: an R package for fitting hierarchical models of wildlife occurrence and abundance. Journal of Statistical Software 43(10).