simPOP: Simulate data for a demographic state-space model

View source: R/simPOP_AHM2_1-7-1.R

simPOPR Documentation

Simulate data for a demographic state-space model

Description

Simulate multiple time-series of counts under a pure Markov model (with exponential population model) or under an extended Markov model with exponential-plus-random-immigration population model; see Sollmann et al.(2015). Default is Markov model, setting sd.rho to a value greater than 0 changes to extended Markov and sets the amount of random immigration.

Usage

simPOP(M = 100, T = 10, mean.lam = 3, beta.lam = 0, sd.log.lam = 0,
  mean.gamma = 1.0, beta.gamma = 0, sd.log.gamma.site = 0,
  sd.log.gamma.time = 0, sd.log.gamma.survey = 0, sd.rho = 0,
  mean.p = 0.6, beta.p = 0, sd.logit.p.site = 0, sd.logit.p.time = 0,
  sd.logit.p.survey = 0, show.plot = TRUE)

Arguments

M

The number of sites.

T

The number of years.

mean.lam

The mean abundance for year 1.

beta.lam

The covariate coefficient for lambda.

sd.log.lam

The over-dispersion in lambda.

mean.gamma

The mean population growth rate.

beta.gamma

The covariate coefficient for gamma.

sd.log.gamma.site

SD of random site effects for gamma.

sd.log.gamma.time

SD of random time effects for gamma.

sd.log.gamma.survey

SD of random survey (site+time) effects for gamma.

sd.rho

The random immigration term.

mean.p

The mean detection probability.

beta.p

The covariate coefficient for p.

sd.logit.p.site

SD of random site effects for p on the logit scale.

sd.logit.p.time

SD of random time effects for p on the logit scale.

sd.logit.p.survey

SD of random survey (site+time) effects for p on the logit scale.

show.plot

Choose whether to show plots or not. Set to FALSE when using function in simulations.

Value

A list with the values of the arguments entered and the following additional elements:

Xsite1

M vector, site covariate affecting initial abundance (lambda).

Xsiteyear1

M x T matrix, yearly site covariate affecting recruitment (gamma).

Xsiteyear2

M x T matrix, yearly site covariate affecting detection (p).

eps.N

M vector, site over-dispersion at t = 1.

lambda

M vector, abundance in year 1.

eps.gamma.site

M vector, random site effect for gamma.

eps.gamma.time

T vector, random time effect for gamma.

eps.gamma.survey

M x T matrix, random survey effect for gamma.

gamma

M x T matrix, population growth rate.

rho

(T-1) vector, immigration rate.

eps.p.site

M vector, random site effect for detection.

eps.p.time

T vector, random time effect for detection.

eps.p.survey

M x T matrix, random survey effect for detection.

p

M x T matrix, detection probability.

N

M x T matrix, true population.

C

M x T matrix, simulated counts.

zeroNyears

scalar, sum(N == 0).

Nextinct

scalar, number of sites where N == 0 at time T.

extrate

scalar, proportion of sites where N == 0 at time T.

sumN

T vector, total population in each year.

gammaX

(T-1) vector, realized population growth rate.

Author(s)

Marc Kéry & Andy Royle

References

Sollmann, R. et al. (2015) An open-population hierarchical distance sampling model. Ecology, 96, 325-331.

Kéry, M. & Royle, J.A. (2021) Applied Hierarchical Modeling in Ecology AHM2 - 1.7.1.

Examples

# Run with the default arguments and look at the structure of the output
set.seed(123)
tmp <- simPOP()
str(tmp)
head(tmp$C)



AHMbook documentation built on Sept. 12, 2024, 6:37 a.m.