Académique Documents
Professionnel Documents
Culture Documents
Assumptions
1) No false identifications
2) Sites are closed, no change in ecological state during sampling
Can use multi-season (dynamic) occupancy models to model colonization and extinction
3) Sites are independent
Sites should be far enough apart such that movement does not occur between sites
Individuals detected at one site cannot be detected at another site
4) No unexplained variability in occupancy among sites or in detection among sites or surveys
We must include covariates in our model that explain variation in detection/occupancy
Sampling Design
1) Duration between temporal replicates should be short enough such that ecological states does not
change (else need to use dynamic models)
2) Sites should be chosen randomly, stratified randomly, or other probabilistic sampling schemes (depending
on species of interest)
Create Data
For our imaginary study, we surveyed 30 different sites for a given species with five replicate surveys for each
site.
sites <- 30
surveys <- 5
y <- array(dim=c(sites,surveys))
Observation process
Our observations of this species are conditional on its state (i.e., we cannot observe a species if it is not present
at a site). Similar to the ecological process, the expected relationship (p) between detection and a covariate
follows a logistic distribution. Thus, our observations of this species (y) follow a Bernoulli distribution. Note,
that we multiply detection probability (p) and occurrence (z), which constrains detection probability to only
be greater than zero when a species is present. We can then find the naive assumption of occupancy based
on our observations and our naive predictions for the relationship between our observations and the covariate
of interest.
set.seed(8675309)
a.p <- -0.1
b.p <- -4
covar.p <- sort(runif(n=sites, min=-1, max=1))
p <- plogis(a.p + b.p*covar.p)
prob.det <- z*p
for(i in 1:surveys){
y[,i] <- rbinom(n=sites, size=1, prob=prob.det)
}
naive.occu <- apply(y, 1, max)
naive.pred <- plogis(predict(glm(naive.occu~covar.psi,
family=binomial)))
1.0
Occupancy Probability ( )
1.0
0.8
0.6
0.4
0.2
0.0
Expected
Naive prediction
0.8
0.6
0.4
0.2
0.0
1.0
0.5
0.0
0.5
1.0
1.0
Detection Covariate
0.5
0.0
Occupancy Covariate
0.5
1.0
Covariates
We can also fit covariates for both detection and occupancy. First, we will determine if our covariate explains
detection and occupancy better than the constant model by the four competeing models using AICc using
the AICcmodavg package.
det.mod <- occu(~covar.p ~1, data.umf)
occu.mod <- occu(~1 ~covar.psi, data.umf)
full.mod <- occu(~covar.p ~covar.psi, data.umf)
# install.packages('AICcmodavg')
library(AICcmodavg)
library(knitr)
4
2
1
3
Modnames
AICc
Delta_AICc
ModelLik
AICcWt
LL
Cum.Wt
psi(cov) p(cov)
psi(.) p(cov)
psi(.) p(.)
psi(cov) p(.)
4
3
2
3
61.09
67.53
68.04
69.09
0.00
6.44
6.95
7.99
1.00
0.04
0.03
0.02
0.92
0.04
0.03
0.02
-25.75
-30.31
-31.80
-31.08
0.92
0.95
0.98
1.00
Sites Occupied
We can estimate the number of sites predicted as occupied from both the occupancy model and the logistic
regression. To extract the state predictions, we will use ranef() to estimate the posterior distributions of the
random variable (occurrence) bup(), which extracts the posterior median of the Best Unbiased Predictor, and
confint(), which computes confidence intervals. For the logistic regression, well extract the predictions and
standard errors using augment() in the broom package.
re <- ranef(full.mod)
glm.aug <- broom::augment(glm(naive.occu~covar.psi,
family=binomial))
library(dplyr)
glm.aug <- glm.aug %>%
select(.fitted, .se.fit) %>%
mutate(lower=.fitted-.se.fit,
upper=.fitted+.se.fit)
kable(data.frame(Estimate=c('Reality','Occupancy Model Estimate','Naive Estimate'),
'Sites Occupied'=c(total.occu, sum(bup(re, stat="mode")), sum(naive.pred)),
'Lower.CI'=c(NA, sum(confint(re)[,1]), sum(plogis(glm.aug$lower))),
'Upper.CI'=c(NA, sum(confint(re)[,2]), sum(plogis(glm.aug$upper)))),
digits=1)
Estimate
Sites.Occupied
Lower.CI
Upper.CI
19
18
6
NA
13.0
3.6
NA
20.0
9.6
Reality
Occupancy Model Estimate
Naive Estimate
1.00
Observed
Expected
Occupancy Probability ( )
Estimate
0.75
Naive
Occupancy
Reality
0.50
0.25
0.00
1.0
0.5
0.0
Covariate
0.5
1.0