Occupancy Where a species occurs; which of a set of suitable patches - - PowerPoint PPT Presentation

occupancy
SMART_READER_LITE
LIVE PREVIEW

Occupancy Where a species occurs; which of a set of suitable patches - - PowerPoint PPT Presentation

Occupancy Where a species occurs; which of a set of suitable patches are occupied; what determines where a species can live... (Metapopulation) ecology, conservation, red-listing Occupancy: the proportion of sites occupied by a species


slide-1
SLIDE 1
slide-2
SLIDE 2

Occupancy

◮ Where a species occurs; which of a set of suitable patches are

  • ccupied; what determines where a species can live...

◮ (Metapopulation) ecology, conservation, red-listing

slide-3
SLIDE 3

Occupancy: the proportion of sites occupied by a species

slide-4
SLIDE 4

Occupancy: the proportion of sites occupied by a species

◮ Occupancy: Ψ = occupied

total

◮ logit(Ψ) = f (covariates)

slide-5
SLIDE 5

The species is not detected in all occupied cells

Detection probability p < 1 ‘Naive approach’: ◮ Ψ × p = occupied

total

◮ logit(Ψ × p) = f (covariates)

slide-6
SLIDE 6

The species is not detected in all occupied cells

Repeated sampling Assumptions: ◮ Closure (no colonisation or exctinction) ◮ No false detections

slide-7
SLIDE 7

The species is not detected in all occupied cells

Survey histories: 1 = detected 0 = not detected ◮ (1,1) 000 ◮ (1,3) 100 ◮ (2,1) 101 ◮ (1,9) 000

slide-8
SLIDE 8

The species is not detected in all occupied cells

Survey histories: 1 = detected 0 = not detected ◮ (1,1) 000 ◮ (1,3) 100 ◮ (2,1) 101 ◮ (1,9) 000 How many occupied cells have no detections?

slide-9
SLIDE 9

A model for the detections

Ψ = probability of a cell to be occupied p = probability of detecting the species given that the cell is

  • ccupied

K = number of visits to each site yi = number of detections at site i Pr(Y = yi) = Ψ K

yi

  • pyi(1 − p)K−yi, yi > 0

= Ψ(1 − p)K + (1 − Ψ), yi = 0

slide-10
SLIDE 10

A hierarchical model

Guillera-Arroita 2017

Ψi = probability that site i is occupied zi = true occupancy at site i: 1 =

  • ccupied, 0 = not occupied

pij = prob of detecting the species at site i during survey j yij = detection (1) or non-detection (0) at site i during survey j zi|Ψi ∼ Bernoulli(Ψi) yij|zi, pij ∼ Bernoulli(zipij)

slide-11
SLIDE 11

A hierarchical model

Ecological process: zi|Ψ ∼ Bernoulli(Ψ) Observation process: yij|zi, p ∼ Bernoulli(zip) model { for (i in 1:nsites) { z[i] ~ dbern(psi) p.eff[i] <- z[i] * p for (j in 1:nvisits) { y[i,j] ~ dbern(p.eff[i]) } #j } #i # Priors psi ~ dunif(0, 1) p ~ dunif(0, 1) # Derived quantities

  • cc.fs <- sum(z[])

}

slide-12
SLIDE 12

Preparing the data

Ψ = 0.5 p = 0.3 ‘Naive’ occupancy:

126 400 = 0.32

> head(y) detected1 detected2 detected3 1 2 3 1 1 4 5 6 1 1 > dim(y) [1] 400 3

slide-13
SLIDE 13

Preparing inputs for JAGS

Ψ = 0.5 p = 0.3 ‘Naive’ occupancy:

126 400 = 0.32

library(jagsUI) # requires JAGS

  • cc.data <- list(y = y, nsites = nrow(y),

nvisits = ncol(y)) # Initial values zst <- apply(y, 1, max) inits <- function() list(z = zst) # Parameters monitored params <- c("psi", "p", "occ.fs") # MCMC settings nc <- 3; ni <- 5000; nb <- 2000

slide-14
SLIDE 14

Fitting the model to the data

> out.occ <- jags(occ.data, inits, params, "occ.txt", n.chains=nc, n.iter=ni, n.burn = nb) > out.occ$summary mean sd Rhat n.eff psi 0.4578 0.0448 1.0028 752 p 0.3274 0.0331 1.0016 1675

  • cc.fs

182.8655 15.2283 1.0016 1312 deviance 690.6184 35.3438 1.0016 1276

slide-15
SLIDE 15

WARNING: MCMC can be dangerous!

> plot(out.occ)

2000 2500 3000 3500 4000 4500 5000 0.30 0.55 Iterations

Trace of psi

0.3 0.4 0.5 0.6 4 8

Density of psi

N = 1500 Bandwidth = 0.008699 2000 2500 3000 3500 4000 4500 5000 0.25 0.40 Iterations

Trace of p

0.20 0.25 0.30 0.35 0.40 0.45 4 8

Density of p

N = 1500 Bandwidth = 0.006444 2000 2500 3000 3500 4000 4500 5000 140 220 Iterations

Trace of occ.fs Density of occ.fs

0.000 0.020 143 160 180 200 220 240 254 2000 2500 3000 3500 4000 4500 5000 600 750 Iterations

Trace of deviance

600 650 700 750 800 850 0.000 0.010

Density of deviance

N = 1500 Bandwidth = 6.896

slide-16
SLIDE 16

Bad example

If your chains look like this, don’t trust the output!!

slide-17
SLIDE 17

Covariate modelling

Want to know how occupancy and detection vary among sites, i, and visits, j. logit(Ψi) = β0 + β1xi1 + . . . + βUxiU logit(pij) = β0 + β1xi1 + . . . + βUxiU + βU+1yij1 + . . . + βU+V yijV U site-level covariates: xi1, . . . , xiU V survey-specific covariates: yij1, . . . , yijV

slide-18
SLIDE 18

Occupancy and detection vary in space

true occupancy 0.0 0.5 1.0 true detection 0.0 0.5 1.0 10 20 Longitude

slide-19
SLIDE 19

Occupancy and detection vary in space

logit(Ψi) = βΨ

1 + βΨ 2 longi

logit(pij) = βp

1 + βp 2 longi

model { # Ecological model for (i in 1:nsites) { z[i] ~ dbern(psi[i]) # Observation model p.eff[i] <- z[i] * p[i] for (j in 1:nvisits) { y[i,j] ~ dbern(p.eff[i]) } #j } #i # covariates for (i in 1:nsites){ logit(psi[i]) = beta.psi[1] + beta.psi[2]*long[i] logit(p[i]) = beta.p[1] + beta.p[2] * long[i] } # Priors for (b in 1:2){ beta.psi[b] ~ dnorm(0, 0.01) beta.p[b] ~ dnorm(0, 0.01) } }

slide-20
SLIDE 20

Occupancy and detection vary in space

  • cc.data <- list(y = y, nsites = nrow(y),

nvisits = ncol(y), long=long) inits <- function() list(z = zst, beta.psi=runif(2,-3,3), beta.p=runif(2,-3,3)) params <- c("beta.psi", "beta.p", "occ.fs")

  • ut.occ.cov <- jags(occ.data,inits,params,"occ_cov.txt",

n.chains=3, n.iter=5000, n.burn = 2000)

slide-21
SLIDE 21

Occupancy and detection vary in space

> out.occ.cov$summary mean sd 2.5% 97.5% Rhat n.eff beta.psi[1]

  • 2.59

0.350

  • 3.31
  • 1.93

1 2674 beta.psi[2] 0.27 0.042 0.20 0.36 1 2755 beta.p[1] 2.07 0.320 1.46 2.72 1 1340 beta.p[2]

  • 0.20

0.023

  • 0.25
  • 0.16

1 1185 deviance 722.23 22.120 681.30 768.56 1 4385

slide-22
SLIDE 22

Check convergence!

2000 2500 3000 3500 4000 4500 5000 −4.5 −3.5 −2.5 −1.5 Iterations

Trace of beta.psi[1]

−4.5 −4.0 −3.5 −3.0 −2.5 −2.0 −1.5 −1.0 0.0 0.4 0.8

Density of beta.psi[1]

N = 1500 Bandwidth = 0.06903 2000 2500 3000 3500 4000 4500 5000 0.15 0.25 0.35 0.45 Iterations

Trace of beta.psi[2]

0.1 0.2 0.3 0.4 0.5 2 4 6 8 10

Density of beta.psi[2]

N = 1500 Bandwidth = 0.008204 2000 2500 3000 3500 4000 4500 5000 1.5 2.0 2.5 3.0 Iterations

Trace of beta.p[1]

1.0 1.5 2.0 2.5 3.0 0.0 0.4 0.8 1.2

Density of beta.p[1]

N = 1500 Bandwidth = 0.06311 2000 2500 3000 3500 4000 4500 5000 −0.26 −0.20 −0.14 Iterations

Trace of beta.p[2]

−0.25 −0.20 −0.15 5 10 15

Density of beta.p[2]

N = 1500 Bandwidth = 0.004445 2000 2500 3000 3500 4000 4500 5000 190 210 230 250 Iterations

Trace of occ.fs Density of occ.fs

0.00 0.02 0.04 183 195 205 215 225 235 245 2000 2500 3000 3500 4000 4500 5000 650 700 750 800 Iterations

Trace of deviance

650 700 750 800 0.000 0.010

Density of deviance

N = 1500 Bandwidth = 4.285

slide-23
SLIDE 23

Estimated occupancy probability

true occupancy 0.0 0.5 1.0 10 20 Longitude

logit(Ψi) = β0 + β1longi

slide-24
SLIDE 24

Estimated occupancy probability

logit(Ψi) = β0 + β1 × longi Ψi =

1 1+e−(β0+β1×longi )

new.long <- 1:20 pr.s <- inv.logit(-2.59 + 0.27 * new.long) > pr.s [1] 0.089 0.114 0.145 0.182 0.226 0.277 0.334 0.397 [9] 0.464 0.532 0.599 0.662 0.720 0.772 0.816 0.853 [17] 0.884 0.909 0.930 0.945

slide-25
SLIDE 25

Estimated occupancy probability

true occupancy

  • 0.0

0.5 1.0 true detection

  • 0.0

0.5 1.0 10 20 Longitude

True occupancy Fitted occupancy

slide-26
SLIDE 26

Southern bals ibis range in South Africa

www.flickr.com/photos/12457947@N07/4251701580

slide-27
SLIDE 27

Second Southern African Bird Atlas Project

http://sabap2.adu.org.za/

slide-28
SLIDE 28

Southern bals ibis

c Peter Ryan

slide-29
SLIDE 29

Southern bals ibis

www.flickr.com/photos/12457947@N07/4251701580

◮ Data: 30 June 2015 to 1 July 2017 ◮ 3220 grid cells 5′ × 5′ ◮ 26’619 checklists (1 to 719 per cell) ◮ Site-level covariates: mean temp coldest month, mean temp warmest month, ratio actual to potential evapotranspiration, wet season intensity ◮ Survey-specific covariates: log(hours observed)

slide-30
SLIDE 30

Preparing the data: long table format

> head(bi.m) Pentad Start_Date lat long Total_hours Spp 2240_2820 2016-05-28 -22.70833 28.37500 4 2240_2820 2015-10-10 -22.70833 28.37500 2 2235_2825 2015-10-11 -22.62500 28.45833 2 2235_2815 2015-09-25 -22.62500 28.29167 4 2240_2815 2015-09-25 -22.70833 28.29167 2

slide-31
SLIDE 31

After some data wrangling

> y[1:5,1:10] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] NA NA NA NA NA NA NA NA NA [2,] NA NA NA NA NA NA NA NA NA [3,] [4,] NA NA NA NA NA NA NA NA [5,] NA NA NA NA NA NA NA NA > dim(y) [1] 3220 719

slide-32
SLIDE 32

Survey-specific covariates

> lhours[1:5,1:10] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.69 NA NA NA NA NA NA NA NA NA [2,] 1.39 NA NA NA NA NA NA NA NA NA [3,] 1.61 1.39 1.6 2.1 1.1 0.69 1.8 1.4 0.69 1.4 [4,] 0.69 1.39 NA NA NA NA NA NA NA NA [5,] 1.61 0.69 NA NA NA NA NA NA NA NA > dim(lhours) [1] 3220 719

slide-33
SLIDE 33

Site-specific covariates

> head(MTCO) [,1] [1,] 0.981870 [2,] 0.981870 [3,] 1.041489 [4,] 1.071299 [5,] 1.429016 [6,] 1.429016 > dim(MTCO) [1] 3220 1 ◮ One value per grid cell ◮ Covariates scaled to ¯ x = 0, s = 1

slide-34
SLIDE 34

The model

zi|Ψi ∼ Bernoulli(Ψi) yij|zi, pij ∼ Bernoulli(zipij) logit(Ψi) = βΨ

1 + βΨ 2 MTCOi + βΨ 3 MTWAi + βΨ 4 AET.PETi + βΨ 5 Wet.intensityi

logit(pij) = βp

1 + βp 2lhoursij

slide-35
SLIDE 35

The model

New features: ◮ # visits varies among sites ◮ multiple covariates ◮ observation-level covariates

model { for (i in 1:nsites) { z[i] ~ dbern(psi[i]) for (j in 1:ncards[i]) { p.eff[i,j] <- z[i] * p[i,j] y[i,j] ~ dbern(p.eff[i,j]) } #j } #i # covariates for (i in 1:nsites){ logit(psi[i]) = beta.psi[1] + beta.psi[2] * MTCO[i] + beta.psi[3] * MTWA[i] + beta.psi[4] * AET.PET[i] + beta.psi[5] * Wet.Intensity[i] for (j in 1:ncards[i]){ logit(p[i,j]) = beta.p[1] + beta.p[2] * lhours[i,j] } #j } #i . .

slide-36
SLIDE 36

The model

New features: ◮ # visits varies among sites ◮ multiple covariates ◮ observation-level covariates

. . . # Priors for (b in 1:5){ beta.psi[b] ~ dnorm(0, 0.01) } for (b in 1:2){ beta.p[b] ~ dnorm(0, 0.01) } }

slide-37
SLIDE 37

The model

Data: ◮ survey histories y ◮ site-level covariates

◮ MTCO ◮ MTWA ◮ AET.PET ◮ Wet.intensity

◮ observation-level covariates: lhours ◮ # sites: nsites ◮ # visits: ncards Parameters: ◮ coefficients for site-level covariates: beta.psi ◮ coefficients for

  • bservation-level covariates:

beta.p → need priors → need initial values Unobserved true occupancy state: zi → need initial values

slide-38
SLIDE 38

Fit model and check convergence

  • ut.occ.ib <- jags(occ.data,inits,params,"occ_ibis.txt",

n.chains=3, n.iter=5000, n.burn = 2000) plot(out.occ.ib)

2000 2500 3000 3500 4000 4500 5000 −3.2 −2.4 Iterations

Trace of beta.psi[1]

−3.2 −3.0 −2.8 −2.6 −2.4 −2.2 −2.0 0.0 1.5

Density of beta.psi[1]

N = 1500 Bandwidth = 0.03136 2000 2500 3000 3500 4000 4500 5000 −2.0 −0.5 Iterations

Trace of beta.psi[2]

−2.5 −2.0 −1.5 −1.0 −0.5 0.0 0.0 0.8

Density of beta.psi[2]

N = 1500 Bandwidth = 0.06299 2000 2500 3000 3500 4000 4500 5000 −2.0 −0.5 Iterations

Trace of beta.psi[3]

−2.0 −1.5 −1.0 −0.5 0.0 0.5 0.0 0.6 1.2

Density of beta.psi[3]

N = 1500 Bandwidth = 0.06471 2000 2500 3000 3500 4000 4500 5000 2 4 6 Iterations

Trace of beta.psi[4]

2 3 4 5 6 0.0 0.4 0.8

Density of beta.psi[4]

N = 1500 Bandwidth = 0.1003 2000 2500 3000 3500 4000 4500 5000 −3.5 −1.5 Iterations

Trace of beta.psi[5]

−4.0 −3.5 −3.0 −2.5 −2.0 −1.5 −1.0 −0.5 0.0 0.6

Density of beta.psi[5]

N = 1500 Bandwidth = 0.08252 2000 2500 3000 3500 4000 4500 5000 −1.8 −1.3 Iterations

Trace of beta.p[1]

−1.8 −1.6 −1.4 −1.2 2

Density of beta.p[1]

N = 1500 Bandwidth = 0.02002 2000 2500 3000 3500 4000 4500 5000 −0.2 0.2 Iterations

Trace of beta.p[2]

−0.2 0.0 0.2 0.4 2 4

Density of beta.p[2]

N = 1500 Bandwidth = 0.01642 2000 2500 3000 3500 4000 4500 5000 4850 5050 Iterations

Trace of deviance

4800 4850 4900 4950 5000 5050 5100 0.000 0.008

Density of deviance

N = 1500 Bandwidth = 7.315

slide-39
SLIDE 39

Southern bals ibis

c Peter Ryan MTCO 0.70 9.45 18.20 0.0 0.5 1.0 MTWA 10.8 19.1 27.4 AET/PET 0.237 0.615 0.993 0.0 0.5 1.0 Wet.Intensity 0.00 91.55 183.10

Occupancy probability

slide-40
SLIDE 40

Southern bals ibis

c Peter Ryan

slide-41
SLIDE 41

Single-season occupancy models

◮ Repeated detection / non-detection data ◮ Estimate occupancy and detection process ◮ Key assumptions: closure, no false detections, surveys are independent, sites are independent ◮ Can be fitted using JAGS via R package ‘jagsUI’ ◮ Other software: R package ‘unmarked’, PRESENCE, MARK

slide-42
SLIDE 42

Why go Bayesian?

◮ more flexible ◮ easy to add random effects ◮ spatial autocorrelation ◮ can use prior information

slide-43
SLIDE 43

Key references

Single-season occupancy models: ◮ MacKenzie, D. I., J. D. Nichols, G. B. Lachman, S. Droege, J. A. Royle, and C.

  • A. Langtimm. 2002. Estimating site occupancy rates when detection

probabilities are less than one. Ecology 83: 2248-2255. ◮ MacKenzie, D. I., J. D. Nichols, J. A. Royle, K. H. Pollock, L. L. Bailey, and J.

  • E. Hines. 2017. Occupancy Estimation and Modeling: Inferring Patterns and

Dynamics of Species Occurrence. Academic Press. ◮ Guillera-Arroita, G. 2017. Modelling of species distributions, range dynamics and communities under imperfect detection: advances, challenges and

  • pportunities. Ecography 40:281295.

Occupancy models in BUGS: ◮ K´ ery, M., and M. Schaub. 2012. Bayesian Population Analysis using WinBUGS: A hierarchical perspective. Academic Press. ◮ K´ ery, M., and J. A. Royle. 2016. Applied Hierarchical Modeling in Ecology. Academic Press.