simOU.capthist: Simulate Detections For Ornstein-Uhlenbeck Movement

simOU.capthistR Documentation

Simulate Detections For Ornstein-Uhlenbeck Movement

Description

The usual SECR model ignores the sequential locations of an individual within its home range. Movement models predict serial correlation of detections in space. The Ornstein-Uhlenbeck (OU) model is a convenient example that over long durations leads to a bivariate normal distribution of locations.

Movements of a single animal according to the OU model are simulated in discrete time with simOU.

Detections of a population of individuals with pre-defined activity centres are simulated with simOU.capthist. Detection happens when the location of an individual at time t (occasion t) is within distance epsilon \epsilon of a detector.

Usage


simOU(xy, tau, sigma, noccasions, start = NULL)

simOU.capthist(traps, popn, detectpar, noccasions, seed = NULL,
    savepopn = FALSE, savepath = FALSE, ...)

Arguments

xy

numeric vector of x,y coordinates for one animal

tau

numeric parameter of serial correlation = 1 / \beta

sigma

numeric spatial scale parameter

noccasions

integer number of time steps

start

numeric vector of x,y coordinates for initial location (optional)

traps

secr traps object

popn

secr popn object or a 2-column matrix of x-y coordinates of activity centres

detectpar

list with values of detection parameters epsilon, sigma, and tau

seed

either NULL or an integer that will be used in a call to set.seed

savepopn

logical; if TRUE the population is saved as an attribute

savepath

logical; if TRUE the movement paths are saved as an attribute

...

other arguments passed to reduce.capthist

Details

The first location for simOU by default is drawn at random from the asymptotic distribution.

The detection parameters are:

epsilon radius within which individual detected with certainty
sigma spatial scale of asymptotic bivariate normal
tau serial correlation parameter 1/beta

In a final step, ‘simOU.capthist’ uses the reduce method for capthist objects to coerce the simulated capthist object to the detector type of the traps argument.

The ... argument may be used to pass the 'by' argument to reduce.capthist. For example, 'by = "ALL"' collapses the initially binary data for a single detector on noccasions to a single integer. Alternatively, 'by = 10' collapses the original occasions in groups of 10. Data will be lost unless the input traps object has detector type 'count'.

The x- and y-dimensions are simulated separately, assuming circularity. The distribution of location on the x axis at time t+1 conditional on the location at time t is then

x_{t+1} | x_{t} \sim N(\mu_x + e^{\frac{-1}{\tau}(x_{t} - \mu_x)}, \; \sigma^2 (1 - e^{\frac{-2}{\tau}}),

where \mu = (\mu_x, \mu_y) is the long-term activity centre and \tau (tau) is a parameter for the strength of serial correlation (\tau = 1/\beta in other formulations). The scale of the long-term (asymptotic) bivariate normal home range is governed by \sigma as usual. Steps are implicitly of length 1 occasion so \Delta t is omitted.

Value

simOU - matrix of locations dim = c(noccasions, 2)

simOU.capthist - single-session capthist object for secr

See Also

sim.capthist

Examples


# one animal
locs <- simOU(c(0,0), 20, 1, 100)
par(pty = 's')
plot(locs, type = 'o', xlim = c(-2.5,2.5), ylim = c(-2.5,2.5))
points(0,0, pch = 16, col = 'red')



# simulate some capture data
set.seed(123)
grid <- make.grid(8, 8, spacing = 2)
pop <- sim.popn(D = 1000, core = grid, buffer = 4)
ch <- simOU.capthist(grid, pop, detectpar=list(tau = 50, sigma = 1, epsilon = 0.25), 
   noccasions = 100, savepath = TRUE)

# plot simulated capthist with overlay of movements and AC
plot(ch, rad = 0.1, tracks = TRUE, varycol = FALSE, border = 4)
sapply(attr(ch, 'path'), lines, col = 'grey')
plot(pop, add = TRUE, pch = 16, cex = 0.6)

# fit a model
fit <- secr.fit(capthist = ch, buffer = 8, detectfn = 14, trace = FALSE)
predict(fit)




secrdesign documentation built on June 13, 2025, 9:08 a.m.