simDM {AHMbook} | R Documentation |

## Simulate count data under the dynamic N-mixture model of Dail-Madsen

### Description

Simulation for multiple-visit data (from `pcountOpen`

help file in package unmarked). `simDM0`

has no covariates while `simDM`

allows for covariates. Both functions assume constant time intervals between primary periods.

### Usage

```
simDM0(nsites = 50, nsurveys = 3, nyears = 5,
lambda = 4, gamma = 1.5, phi = 0.8, p = 0.7, show.plots=TRUE)
simDM(nsites = 50, nsurveys = 3, nyears = 5,
mean.lambda = 4, mean.gamma.rel = 0.5,
mean.phi = 0.8, mean.p = 0.7,
beta.lam = 1, beta.gamma = 1, beta.phi = -1, beta.p = -1,
show.plots=TRUE)
```

### Arguments

`nsites` |
number of sites. |

`nsurveys` |
number of replicate (secondary) samples within period of closure. |

`nyears` |
number of primary samples: years, seasons etc. |

`lambda` |
Initial expected abundance. |

`gamma` |
recruitment rate. |

`phi` |
apparent survival rate. |

`p` |
detection probability. |

`mean.lambda` |
Initial expected abundance at cov.lam = 0. |

`mean.gamma.rel` |
recruitment rate at cov.gamma = 0. |

`mean.phi` |
apparent survival rate at cov.phi = 0. |

`mean.p` |
detection probability at cov.p = 0. |

`beta.lam` |
the slope of parameter lambda (link transformed) on the cov.lam covariate |

`beta.gamma` |
the slope of parameter gamma (link transformed) on the cov.gamma covariate |

`beta.phi` |
the slope of parameter phi (link transformed) on the cov.phi covariate |

`beta.p` |
the slope of parameter p (link transformed) on the cov.p covariate |

`show.plots` |
if TRUE, plots are produced. Set this to FALSE when running simulations. |

### Value

For `simDM0`

, a list with the values of the input arguments and the following additional elements:

`N` |
true number of individuals, nsites x nyears |

`S` |
number of survivors, nsites x (nyears-1) |

`R` |
number of recruits, nsites x (nyears-1) |

`y` |
number detected, nsites x nyears x nsurveys |

`yy` |
number detected as a matrix, nsites x (nyears*nsurveys) |

`simDM`

has the following additional elements:

`cov.lam` |
covariate for lambda generated from Uniform(-1, 1), nsites vector |

`cov.gamma` |
covariate for gamma generated from Uniform(-1, 1), nsites vector |

`cov.phi` |
covariate for phi generated from Uniform(-1, 1), nsites vector |

`cov.p` |
covariate for p generated from Uniform(-1, 1), nsites x nyears x nsurveys |

`ccov.p` |
cov.p formatted as a matrix, nsites x (nyears*nsurveys) |

### Author(s)

Marc Kéry & Andy Royle, based in part on code written by Richard Chandler.

### References

Dail, D. & Madsen, L. (2011) Models for estimating abundance from repeated counts of an open metapopulation. *Biometrics*, 67, 577-587.

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

### Examples

```
# Simulate a data set with the default arguments and look at the structure of the output:
tmp0 <- simDM0()
str(tmp0)
tmp <- simDM()
str(tmp)
```

*AHMbook*version 0.2.9 Index]