# NOT RUN {
# }
# NOT RUN {
## 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 = "proximity")
temp <- read.table("ovencapt.txt", colClasses=c("character",
"character", "numeric", "numeric", "character"))
ovenCHp <- make.capthist(temp, netsites0509, covnames=c("Sex"))
ovenCHp <- updateCH(ovenCHp) # drop repeat detections
# }
# NOT RUN {
par(mfrow = c(1,5), mar = c(1,1,4,1))
plot(ovenCHp, tracks = TRUE, varycol = TRUE)
par(mfrow = c(1,1), mar = c(5,4,4,2) + 0.1) ## defaults
counts(ovenCHp, "n")
# }
# NOT RUN {
## trimmed version of data - for consistency with earlier versions
ovenCH <- reduce(ovenCHp, outputdetector = "multi", dropunused = FALSE)
## 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
# }
# NOT RUN {
## 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