Learn R Programming

secrlinear (version 1.0.5)

sim.linearpopn: Simulate Animals on Lines

Description

This function is a simple substitute for the secr function sim.popn() for the case of a linear habitat.

Usage

sim.linearpopn(mask, D, N, Ndist = c('poisson', 'fixed'), ...)

Arguments

mask
linearmask object
D
numeric density animals / km
N
number of individuals
Ndist
character string for distribution of total number of individuals
...
other arguments passed to sim.popn

Value

  • Object of class c(`linearpopn', `popn', `data.frame').

Details

The linearmask input represents a discretized line - essentially a chain of line segments. By default, each segment is populated with a Poisson number of individuals. The user may specify D or N. D may be a vector with one density per mask pixel, or a single number that will be applied across all pixels. If Ndist = 'fixed' then a constant number of individuals N are simulated in each trial; otherwise N has a Poisson distribution across trials. N = sum(D) x mask length if D is specified. This is a simplified wrapper for sim.popn called with model2D = "linear".

See Also

linearpopn, sim.popn

Examples

Run this code
x <- seq(0, 4*pi, length = 200)
xy <- data.frame(x = x*100, y = sin(x)*300)
mask <- read.linearmask(data = xy, spacing = 10)
trps <- make.line(mask, n = 15, startbuffer = 1000, by = 30)

newmask <- clipmask(mask, trps, buffer = 200)

linpop <- sim.linearpopn(newmask, 200)
CH <- sim.capthist(trps, linpop, userdist = networkdistance)
plot(newmask)
plot(CH, add = TRUE)

secr.fit(CH, mask = mask, details = list(userdist = networkdistance))

Run the code above in your browser using DataLab