# Simulate a population with the default arguments:
str(pop <- simPop())
pop$N
# Try View, but not available on all platforms
# View(pop$state)
pop$phi
pop$f
pop$reprod[1:5,,]
# Just one (adult) age group:
str(pop <- simPop(Ni=20))
pop$N
pop$phi
pop$f
# Using matrices for time-dependent survival, fecundity
phi <- matrix(c(
0.3, 0.5, 0.5, 0.2, 0.2, # newborns
0.5, 0.7, 0.7, 0.4, 0.4), # adults
nrow=2, byrow=TRUE)
f <- matrix(c(3, 4, 5, 2, 2, 3), nrow=1)
str(pop <- simPop(phi=phi, f=f))
pop$phi
pop$f # Matrices expanded to all adult age classes
pop$N
# With immigration
str(pop <- simPop(Im=5))
pop$N
# with ageOfIm = 1 (default) immigrants are included in 1-Year figures.
# Not all 1-Years attempt to breed, and fecundity is lower
str(pop <- simPop(f = c(2, 3.2), pBreed = c(0.7, 1)))
pop$f
pop$pBreed
# Note the difference between numbers of breeders and adults among 1-Years
pop$breeders
pop$N
# Extinction
set.seed(1)
str(pop <- simPop(f = 0.1, phi = c(0.1, 0.2)))
pop$N
# Sink population, rescued by immigration
set.seed(1)
str(pop <- simPop(f = 0.1, phi = c(0.1, 0.2), Im=5))
pop$N
Run the code above in your browser using DataLab