par (mfrow = c(2,3), mar = c(1,1,1,1))
## birth and death only
grid <- make.grid(nx = 7, ny = 4, detector = 'proximity', spacing = 10)
pop <- sim.popn (Nbuffer = 100, core = grid, nsessions = 6,
details = list(lambda = 0.8, phi = 0.6))
sapply(pop, nrow) ## how many individuals?
plot(pop)
## movement only
pop2 <- sim.popn (Nbuffer = 100, core = grid, nsessions = 6,
details = list(lambda = 1, phi = 1, movemodel = 'normal',
move.a = 10, edgemethod = "wrap"))
pop3 <- sim.popn (Nbuffer = 100, core = grid, nsessions = 6,
details = list(lambda = 1, phi = 1, movemodel = 'normal',
move.a = 10, edgemethod = "clip"))
pop4 <- sim.popn (Nbuffer = 100, core = grid, nsessions = 10,
details = list(lambda = 1, phi = 1, movemodel = 'normal',
move.a = 10, edgemethod = "stop"))
sapply(pop2, nrow) ## how many individuals?
plot(pop2)
## show effect of edgemethod --
## first session blue, last session red
cols <- c('blue',rep('white',4),'red')
par (mfrow=c(1,2))
plot(pop2, collapse = TRUE, seqcol = cols)
plot(pop3, collapse = TRUE, seqcol = cols)
## zero-inflated movement
## move.b is zero-inflation probability
pop5 <- sim.popn (Nbuffer = 1000, core = grid, nsessions = 6,
details = list(lambda = 1, phi = 1, movemodel = 'RDEzi',
move.a = 50, move.b = 0.5, edgemethod = "none"))
mean(do.call(rbind,extractMoves(pop5))$d) # approx 50 * 0.5
Run the code above in your browser using DataLab