## commands used to create ovenCH from the input files
## "netsites0509.txt" and "ovencapt.txt"
## for information only - these files not distributed
netsites0509 <- read.traps(file = "netsites0509.txt",
skip = 1, detector = "multi")
temp <- read.table("ovencapt.txt", colClasses=c("character",
"character", "numeric", "numeric", "character"))
ovenCH <- make.capthist(temp, netsites0509, covnames=c("Sex"))
oldpar <- par(mfrow = c(1,5), mar = c(1,1,4,1))
plot(ovenCH, tracks = TRUE, varycol = TRUE)
par(oldpar)
counts(ovenCH, "n")
## array constant over years, so build mask only once
ovenmask <- make.mask(traps(ovenCH)[["2005"]], type="pdot", buffer=400,
spacing=15, detectpar=list(g0=0.03, sigma=90), nocc=10)
## fit constant-density model
ovenbird.model.1 <- secr.fit(ovenCH, mask = ovenmask)
ovenbird.model.1
## fit net avoidance model
ovenbird.model.1b <- secr.fit(ovenCH, mask = ovenmask, model =
list(g0~b))
ovenbird.model.1b
## fit model with time trend in detection
ovenbird.model.1T <- secr.fit(ovenCH, mask = ovenmask, model =
list(g0 ~ T))
ovenbird.model.1T
## fit model with 2-class mixture for g0
ovenbird.model.h2 <- secr.fit(ovenCH, mask = ovenmask, model =
list(g0~h2))
ovenbird.model.h2
## compare & average pre-fitted models
AIC (ovenbird.model.1, ovenbird.model.1b, ovenbird.model.1T,
ovenbird.model.h2)
model.average (ovenbird.model.1,ovenbird.model.1b, ovenbird.model.1T,
ovenbird.model.h2, realnames = "D")
## select one year to plot
plot(ovenbird.model.1b, newdata = data.frame(session = "2005",
b = 0))
Run the code above in your browser using DataLab