simDemoDynocc {AHMbook} | R Documentation |

## Simulate data under a demographic dynamic occupancy model

### Description

Function to simulate detection/nondetection data under a variant of the demographic occupancy (or 'local survival') model of Roth & Amrhein (2010). Data are simulated in an 'unconditional' manner, i.e., for each site from first to last year. All parameters can be made year-dependent by specification of a range within which annual values will be drawn from uniform distributions.

### Usage

```
simDemoDynocc(nsites = 100, nyears = 10, nvisits = 5, psi1 = 0.6,
range.phi = c(0.2, 0.9), range.r = c(0, 0.4), range.p = c(0.1, 0.9),
show.plot=TRUE)
```

### Arguments

`nsites` |
Number of sites. |

`nyears` |
Number of years (or 'seasons', as they are somewhat confusingly often called in the occupancy literature). |

`nvisits` |
Number of replicate surveys (= occasions) within a year. |

`psi1` |
occupancy probability in first year. |

`range.phi` |
bounds of uniform distribution from which annual local probability of persistence is randomly drawn. |

`range.r` |
bounds of uniform distribution from which annual local probability of colonization is randomly drawn. |

`range.p` |
bounds of uniform distribution from which annual probability of detection is randomly drawn. |

`show.plot` |
If TRUE, plots of results are displayed; set to FALSE if running simulations. |

### Value

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

`phi` |
persistence for each interval, a vector of length nyears - 1 |

`r` |
colonization for each interval, a vector of length nyears - 1 |

`p` |
detection probability for each year, a vector of length nyears |

`z` |
true occurrence state, a nsites x nyears matrix of 0/1 |

`y` |
the observed detection history, a nsites x nvisits x nyears array |

`f` |
year of first detection, a vector of length nsites |

`nocc.true` |
the true number of occupied sites, a vector of length nyears |

`nocc.true` |
the observed number of occupied sites, a vector of length nyears |

### Author(s)

Marc Kéry & Andy Royle

### References

Roth, T. & Amrhein, V. (2010), Estimating individual survival using territory occupancy data on unmarked animals. *Journal of Applied Ecology*, 47, 386-392.

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

### Examples

```
# Generate data with the default arguments and look at the structure:
str(data <- simDemoDynocc() ) # Implicit defaults
str(data <- simDemoDynocc(psi1 = 1)) # All sites initially occupied
str(data <- simDemoDynocc(nsites = 1000)) # Plenty more sites
str(data <- simDemoDynocc(nyears = 100)) # Plenty more years
str(data <- simDemoDynocc(nvisits = 20)) # Plenty more visits
str(data <- simDemoDynocc(range.phi = c(0.8, 0.8))) # Constant survival
str(data <- simDemoDynocc(range.phi = c(0.2,0.3), range.r = c(0,0.2))) # Decline
str(data <- simDemoDynocc(range.phi = c(0.8,1), range.r = c(0.5,0.7))) # Increase
str(data <- simDemoDynocc(nvisits = 1)) # Single visit
str(data <- simDemoDynocc(range.p = c(1,1))) # Perfect detection
```

*AHMbook*version 0.2.9 Index]