if (FALSE) {
## smooth density surface
possum.model.sxy <- secr.fit(possumCH, mask = possummask,
model = D ~ s(x,y, k = 6, fx = TRUE), trace = FALSE)
fittedsurface <- predictDsurface(possum.model.sxy)
par(mar = c(1,1,1,6))
plot(fittedsurface)
plot(fittedsurface, plottype = 'contour', add = TRUE)
par(mar = c(5,4,4,2) + 0.1) ## reset to default
## Now try smooth on g0
## For the smooth we use 'Session' which is coded numerically (0:4)
## rather than the factor 'session' ('2005', '2006', '2007', '2008',
## '2009')
ovenbird.model.g0 <- secr.fit(ovenCH, mask = ovenmask,
model = g0 ~ session, trace = FALSE)
ovenbird.model.sg0 <- secr.fit(ovenCH, mask = ovenmask,
model = g0 ~ s(Session, k = 3, fx = TRUE), trace = FALSE)
AIC(ovenbird.model.g0, ovenbird.model.sg0)
## Or over occasions within a session...
fit.sT3 <- secr.fit(captdata, model = g0 ~ s(T, k = 3, fx = TRUE),
trace = FALSE)
pred <- predict(fit.sT3, newdata = data.frame(T = 0:4))
plot(sapply(pred, '[', 'g0', 'estimate'))
}
Run the code above in your browser using DataLab