playRN {AHMbook} | R Documentation |

## Function to play Royle-Nichols (RN) model

### Description

Function generates replicated count data under the binomial N-mixture model of Royle (2004), then 'degrades' the counts to detection/nondetection and fits the Royle-Nichols (RN) model (Royle & Nichols 2003) using unmarked and estimates site-specific abundance.

### Usage

```
playRN(M = 267, J = 3, mean.abundance = 1, mean.detection = 0.3,
show.plots = TRUE, verbose = TRUE)
```

### Arguments

`M` |
The number of sites. |

`J` |
The number of visits to each site. |

`mean.abundance` |
Expected abundance at each site. |

`mean.detection` |
Expected detection at each survey at each site. |

`show.plots` |
choose whether to show plots or not. Set to FALSE when using function in simulations. |

`verbose` |
if FALSE, output to the console will be suppressed. |

### Value

A list with the following elements:

`nsites` |
The number of sites, equal to |

`nvisits` |
The number of visits, equal to |

`coef` |
A named vector of coefficients for the linear models for expected number and detection probability |

`slope` |
Slope of the regression of the estimated number on the true number; 1 if the model is perfect |

### Author(s)

Marc Kéry & Andy Royle

### References

Royle, J.A. & Nichols, J.D. (2003) Estimating abundance from repeated presence-absence data or point counts, *Ecology*, 84, 777-790.

Royle, J.A. (2004) N-mixture models for estimating population size from spatially replicated counts, *Biometrics*, 60, 108-115.

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

### Examples

```
# Run a simulation with the default arguments and look at the results:
playRN()
# Execute the function using various settings
playRN(M = 100, J = 3, mean.abundance = 0.1) # Increasing abundance
playRN(M = 100, J = 3, mean.abundance = 1)
playRN(M = 100, J = 3, mean.abundance = 5)
playRN(M = 100, J = 3, mean.detection = 0.3) # Increasing detection
playRN(M = 100, J = 3, mean.detection = 0.5)
playRN(M = 100, J = 3, mean.detection = 0.7)
playRN(M = 100, J = 20) # More visits
playRN(M = 1000, J = 3) # More sites
```

*AHMbook*version 0.2.9 Index]