Description Details Author(s) See Also Examples
Implements Genaralized Additive Models for modelling density surfaces for Spatially Explicit Capture-Recapture, by means of regression splines.
Package: | secrgam |
Type: | Package |
Version: | 1.0 |
Date: | 2014-01-12 |
License: | GNU General Public License Version 2 or later |
Package secrgam
uses regression splines to implement flexible
density surface estimation for Spatially Explicit Capture-Recapture
methods, using maximum likelihood inference. At its core is package
secr
, which does all the actual estimation; package
secrgam
is just a set of wrapper functions and some plotting
functions that set up the regression spline bases and then call
secr
.
The package currently allows spline models to be specified using syntax
from package mgcv
using the s
and
te
functions. The gam
function is used with
fit=FALSE
to obtain regression spline design matrices.
David Borchers dlb@st-andrews.ac.uk
Darren Kidney darrenkidney@googlemail.com
Maintainer: David Borchers dlb@st-andrews.ac.uk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | library(secrgam)
data(Boland.leopards1)
data(Boland.alt.image)
# plot survey region and traps
Boland.cameras = traps(Boland.CH1)
image(Boland.alt.image, col = terrain.colors(60),main="Altitude map")
contour(Boland.alt.image, add = TRUE)
plot(Boland.cameras, add = TRUE, detpar = list(pch = "+", cex = 1.2))
# summarise and plot capture histories
summary(Boland.CH1)
plot(Boland.CH1, border = 0, rad = 0.01, tracks = TRUE, icolour = colors()[seq(2, 202, 10)])
# make a model with dependence on altitude via smooth with 4 degrees of freedom
model = list(D ~ s(alt, k = 4), g0 ~ 1, sigma ~ 1)
# fit model
## Not run:
fit <- secrgam.fit(capthist = Boland.CH1, model = model, mask = Boland.mask1, trace = FALSE)
fit # look at fit results
# plot fitted surface:
plot(fit,asp=1)
plot(traps(Boland.CH1), add = TRUE)
# plot smooths:
plot(fit, type = "smooth")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.