# simMHB: Simulates detection and count data with spatial and temporal... In IPMbook: Functions and Data for the Book 'Integrated Population Models'

## Description

Function simulates MHB (Monitoring häufige Brutvögel) lookalike data. MHB is the Swiss breeding bird survey that is the source of many classic data sets (e.g. Kéry & Royle, 2016, 2021). This survey was launched in 1999 and for a total of 267 1km2 quadrats laid out in an approximate grid over Switzerland. 2 or 3 surveys are conducted in each breeding season (mid-April to early July) on a quadrat-specific, constant route averaging 4-6 km and all birds detected are mapped, thus yielding replicated counts of unmarked individuals.

The data are simulated under the assumptions of a binomial N-mixture model where for `lambda` we can specify a log-linear trend over the years and we can account for site-level random effects in both the intercept and the slopes of the log-linear model.

For detection probability we have currently a constant average or a logit-linear trend over the years, with no further heterogeneity.

## Usage

 ```1 2 3 4``` ```simMHB(nsites = 267, nsurveys = 3, nyears = 25, mean.lam = 1, mean.beta = 0.03, sd.lam = c(0.5, 0.05), mean.p = 0.6, beta.p = 0.1, show.plot = TRUE) ```

## Arguments

 `nsites` number of sites included in the survey. `nsurveys` number of replicate surveys at each site in each year. `nyears` number of years. `mean.lam` intercept of expected abundance. `mean.beta` average slope of log(lambda) on year. `sd.lam` a length 2 vector, the SDs of the Normal distribution from which random site effects for the intercept and the slope in the log-linear model for lambda are drawn randomly. `mean.p` value of constant detection probability per survey (or intercept of the logit-linear model for p). `beta.p` slope of the logit(p) in year. `show.plot` if TRUE, the output will be displayed graphically.

## Value

A list with the arguments used and the following components:

 `alpha ` vector with intercept used for the log-linear model for lambda for each site. `beta ` vector with slope used for the log-linear model for lambda for each site. `lam ` sites x years matrix with the expected number of animals at each site. `N ` sites x years matrix with the realized number of animals at each site. `totalN ` vector with the total number of animals in each year. `p ` vector with the probability of detection in each year. `C ` sites x surveys x years array with the counts of animals detected.

Marc Kéry

## References

Kéry, M., Royle, A. (2016) Applied Hierarchical Modeling in Ecology Vol 1, Academic Press.

Kéry, M., Royle, A. (2021) Applied Hierarchical Modeling in Ecology Vol 2, Academic Press.

Schaub, M., Kéry, M. (2022) Integrated Population Models, Academic Press, section 4.3.3.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```# Explicit default values for all function arguments str(dat <- simMHB(nsites=267, nsurveys=3, nyears=25, mean.lam=1, mean.beta=0.03, sd.lam=c(0.5, 0.05), mean.p=0.6, beta.p=0.1, show.plot=TRUE)) str(dat <- simMHB()) # Same, implicit str(dat <- simMHB(nsites=1000)) # More sites str(dat <- simMHB(nsurveys=10)) # More surveys str(dat <- simMHB(nyears=50)) # More years str(dat <- simMHB(mean.lam=5)) # Higher mean abundance str(dat <- simMHB(mean.beta=-0.03)) # Population declines str(dat <- simMHB(sd.lam=c(0, 0))) # No site variability in lambda str(dat <- simMHB(mean.p=1)) # Perfect detection str(dat <- simMHB(mean.p=0.6, beta.p=0)) # Constant p = 0.6 str(dat <- simMHB(mean.p=0.6, beta.p=-0.2)) # Declining p str(dat <- simMHB(show.plot=FALSE)) # No plots (when used in simulations) ```

IPMbook documentation built on Dec. 11, 2021, 9:59 a.m.