simpleNmix {AHMbook} | R Documentation |

## Simulate N-mixture data under a time-for-space substitution design

### Description

A simple function to simulate data under binomial N-mixture model where you have a single site that is surveyed over 'nyears' primary sampling periods ('seasons', 'years'), within each of which there are 'nreps' secondary samples.

### Usage

```
simpleNmix(nyears = 12, nreps = 4, beta0 = 2, beta1 = 0.1,
alpha0 = 0.5, alpha1 = -0.1, alpha2 = 1, show.plot = TRUE)
```

### Arguments

`nyears` |
Number of primary sampling periods. |

`nreps` |
Number of secondary samples within each primary period. |

`beta0` |
the intercept of a log-linear model of expected abundance (lambda). |

`beta1` |
the Time coefficient of a log-linear model for lambda. |

`alpha0` |
the intercept of a logit-linear model for detection (p). |

`alpha1` |
the Time coefficient of a logit-linear model for detection (p). |

`alpha2` |
the coefficient of a survey-specific covariate such as temperature (temp). |

`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 input and the following additional elements:

`N` |
The realized number of individuals at each primary season, a vector of length |

`C` |
The number of individuals counted at each survey, a |

`Time` |
The Time covariate, a vector of length |

`temp` |
The temperature covariate, a |

`p` |
The probability of detection, a |

### Author(s)

Marc Kéry & Andy Royle

### References

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

### Examples

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

*AHMbook*version 0.2.9 Index]