Introduction to Occupancy Models

31
Introduction to Occupancy Models 1 Jan 8, 2016 AEC 501 Nathan J. Hostetter [email protected]

Transcript of Introduction to Occupancy Models

Page 1: Introduction to Occupancy Models

Introduction to Occupancy Models

1

Jan 8, 2016AEC 501Nathan J. [email protected]

Page 2: Introduction to Occupancy Models

Occupancy

• Abundance often most interesting variable when analyzing a population

• Occupancy – probability that a site is occupied• Probability abundance is >0

Page 3: Introduction to Occupancy Models

Detection/non‐detection data

• Presence data rise from a two part process • The species occurs in the region of interest AND• The species is discovered by an investigator 

• What do absence data tell us? • The species does not occur at that particular siteOR• The species was not detected by the investigator 

Page 4: Introduction to Occupancy Models

Occupancy studies

• Introduced by MacKenzie et al. 2002 and Tyre et al. 2003

• Allows for collection of data that is less intensive than those based on abundance estimation

• Use a designed survey method like we discussed before – simple random, stratified random, systematic, or double 

• Multiple site visits are required to estimate detection and probability of occurrence 

Page 5: Introduction to Occupancy Models

Why occupancy?• Data to estimate abundance can be difficult to collect, require more time and effort, might be more limited in spatial/temporal scope 

• Obtaining presence/absence data is • Usually less intensive • Cheaper • Can cover a larger area or time frame • Might be more practical for certain objectives 

Page 6: Introduction to Occupancy Models

Why occupancy?

• Some common reasons and objectives• Extensive monitoring programs• Distribution (e.g., ranges shifts, invasive species, etc.) • Habitat selection• Meta‐population dynamics• Species interactions • Species richness 

Page 7: Introduction to Occupancy Models

Occupancy studies

• Key design issues: Replication 

• Temporal replication: • repeat visits to sample units

• Spatial replication: • randomly selected ‘sites’ or sample units within area of interest

Page 8: Introduction to Occupancy Models

Model parameters

• Replication allows us to separate state and observation processes

‐probability site i is occupied.

pij ‐probability of detecting the species in site i at time j, given species is present.

Page 9: Introduction to Occupancy Models

Blue grosbeak example

• Associated with shrub and field habitats, medium sized trees, and edges

• Voluntary program to restore high‐quality early successional habitat in Southern Georgia (BQI – bobwhite quail initiative)

• Are grosbeaks more likely to use fields enrolled in BQI program?

Page 10: Introduction to Occupancy Models

Blue grosbeak example

• N = 41 sites (spatial replication)

• K = 3 sample occasions (temporal replication)

• Example data:Site S1 S2 S31 1 1 12 1 1 03 0 0 0… … … …41 0 1 0

Page 11: Introduction to Occupancy Models

• Sites are closed to changes in occupancy state between sampling occasions• Duration between surveys

• The detection process is independent at each site• Distance between sites

• Probability of detection is constant across sites and visits or explained by covariates

• Probability of occupancy is constant across sites or explained by covariates

Model assumptions

Page 12: Introduction to Occupancy Models

Enough talk, 

Let’s work through the blue grosbeak example

Page 13: Introduction to Occupancy Models

Introduction to R

Basics andOccupancy modeling

13

Page 14: Introduction to Occupancy Models

Intro to R:Submitting commands

Commands can be entered one at a time2+2[1] 4

2^4[1] 16

14

Page 15: Introduction to Occupancy Models

The R environment

15

• Script file (File|New script)• Text file• Save for later use• Submit command by highlighting command at pressing “Crtl R”

• R Console•Where commands are executed

Page 16: Introduction to Occupancy Models

R console: Interactive calculations

#Try the following in the script file:2+2a <‐ 2 + 2 #create the object aa #returns object aA #Nope, case sensitive

b<‐2*3ba+b#Use the +,  ‐,  *,  /, and  ^  symbols# Use “#” to enter comments

16

Page 17: Introduction to Occupancy Models

Built in functions

x1 <‐ c(1,3,5,7)  #vectorx1mean(x1)[1] 4sd(x1)[1] 2.581989

#Help files?mean

17

Page 18: Introduction to Occupancy Models

Loading and storing data setsComma separated variable (CSV)

• Create a CSV file in excel by clicking “save as” and scrolling to “.csv”. CSV files can be opened in excel, but also in any other text editor.

• Say “C:\Documents\data.csv” is an .csv file. To load a csv file:dat <‐ read.csv(“C:\\Documents\\data.csv",header=TRUE)dat

• ?read.csv  #for further help 

18

Page 19: Introduction to Occupancy Models

Saving work

• Save your current session in an R workspace assave.image(“C:\\Documents\\whatever.RData")

• Load a previously saved workspaceFile|Load workspace

• Save script file• Click on script file• File|Save

Check out Brian Reich’s intro to R athttp://www4.stat.ncsu.edu/~reich/ST590/code/Data

19

Page 20: Introduction to Occupancy Models

Intro to Occupancy analysis in R

Blue grosbeak example• Associated with shrub and field habitats, medium sized trees, and edges

• Voluntary program to restore high‐quality early successional habitat in Southern Georgia (BQI – bobwhite quail initiative)

• Are grosbeaks more likely to use fields enrolled in BQI program?

20

Page 21: Introduction to Occupancy Models

Intro to Occupancy analysis in R

Blue grosbeak example• 41 fields were surveyed • Each field visited on 3 occasions during the 2001 breeding season 

• A 500 m transect was surveyed on each field• Data on detection/non‐detection 

21

Page 22: Introduction to Occupancy Models

Load data

blgr<‐ read.csv("www.cals.ncsu.edu/course/zo501/blgr.csv")head(blgr) #first 5 rows

#y.1, y.2, y.3 are detection/non‐detection surveys

summary(blgr)dim(blgr)           #dimensions of the data (how many sites?)colSums(blgr) #sums the columns

#how many fields were enrolled in bqi?#how many fields had blgr detections in during first survey?#what is the naïve occupancy if only the first survey was conducted?

22

Page 23: Introduction to Occupancy Models

Covariates

• Site level covariates• Data that is site specific but does not change with repeated visits• e.g., forest cover, percent urban, tree height, on/off road, etc.

• Observation level covariates• Data that is collected specific to the sample occasion and site• e.g., time of day, day of year, wind, etc.

What type of covariate is bqi?

23

Page 24: Introduction to Occupancy Models

Occupancy analysis – Unmarked 

• Unmarked • R package• Fits models of animal abundance and occurrence• https://cran.r‐project.org/web/packages/unmarked/unmarked.pdf

24

Page 25: Introduction to Occupancy Models

Install Unmarked 

install.packages("unmarked") #Only required first time to installlibrary(unmarked) #loads package, required each time

25

Page 26: Introduction to Occupancy Models

Format data for occupancy analysis in unmarked 

ydat <‐ blgr[,1:3] #select columns 1 through 3, detection databqi <‐ blgr[,4] #select column 4, bqi enrollment

#use built in function to format dataumf <‐ unmarkedFrameOccu(y=ydat, #Observation data must be named ‘y’

siteCovs=data.frame(bqi=bqi)) #name site covariate bqi

umf

26

Page 27: Introduction to Occupancy Models

Occupancy in unmarked #run occupancy model with no covariates# occu(~detection ~occupancy)fm1 <‐ occu(~ 1 ~ 1, umf )

fm1 #look at the output

#Get the estimates for detection backTransform(fm1['det'])

#Get the estimates for occupancy#remember, occupancy is our ‘state variable’backTransform(fm1['state'])#higher or lower than naïve occupancy? Why?

27

Page 28: Introduction to Occupancy Models

Occupancy in unmarked ‐ Covariates #effect of bqi# occu(~detection ~occupancy)fm2 <‐ occu(~ 1 ~ bqi, umf )

fm2 #look at the output#interpret bqi parameter

#Get the estimates for detection backTransform(fm2['det'])

#Get the estimates for occupancybackTransform(fm2['state'])#Nope, a bit more complicated with covariates#?backTransform for options

28

Page 29: Introduction to Occupancy Models

Occupancy in unmarked – Model comparison 

#Compare model support using AICfitlist<‐fitList(fm1, fm2)modSel(fitlist)

Model  nPars AIC  delta   AICwt cumltvWtfm1 2  172.19  0.00   0.61       0.61fm2 3  173.12  0.93   0.39       1.00

29

Page 30: Introduction to Occupancy Models

Summary• Occupancy (presence/absence)

• Usually less intensive to collect• Often less expensive• Can cover a larger area or time frame• Several important fields in ecology focus on occupancy• Might be more practical for monitoring 

• True census is often (always) impossible• Must account for detection probability

• Requires clear objectives• Quantity to be estimated• Temporal and spatial scope• Precision• Practical constraints 

30

Page 31: Introduction to Occupancy Models

EXTRA – Format observation covariates in unmarked

# observation covariates are recorded at each site during each survey 

# (e.g., wind, temperature, time of day , date, etc..)

# observation covariate data will be a matrix with the same dimensions as the observation data (e.g., rows = number of sites, columns = number of visits)

#use built in function to format data

#assume date was recorded for each survey and entered as date.1, date.2, date.3

#these data are not available, but this shows how to write the script

umf <‐ unmarkedFrameOccu(y=ydat, #Observation data must be named ‘y’

siteCovs=data.frame(bqi=bqi), #name site covariate bqi

obsCovs=list(date=blgr[,c("date.1", "date.2", "date.3")])) #name date covariate date

31