simPPe {AHMbook} | R Documentation |

## Simulate a spatial point pattern in a heterogeneous landscape

### Description

The function simulates a spatial point pattern in a heterogeneous landscape simulated on a square landscape. The study area ('core') is simulated inside the larger landscape that includes a buffer. The size of the core is defined by the lscape.size minus twice the buffer.

There is one habitat covariate X that affects the intensity of the points. X is spatially structured with negative-exponential spatial autocorrelation; the parameters of the field can be chosen to create large 'islands' of similar values or no 'islands' at all, in which case the field is spatially unstructured.

The intensity of STATIC points (e.g. animal activity centers) may be inhomogeneous and affected by the coefficient beta, which is the log-linear effect of X.

To recreate the data sets used in the book with R 3.6.0 or later, include `sample.kind="Rounding"`

in the call to `set.seed`

. This should only be used for reproduction of old results.

Previous versions used RandomFields, but that is not currently available on CRAN. fields is now used, but it cannot deal with large values of `lscape.size`

and `theta.X`

. If you have RandomFields installed (perhaps by getting it from the CRAN archive), you can load a version of `simPPe`

that supports it with `source(system.file("RandomFieldsSupport", "simPPe.R", package="AHMbook"))`

.

### Usage

```
simPPe(lscape.size = 150, buffer.width = 25, variance.X = 1, theta.X = 10,
M = 250, beta = 1, quads.along.side = 6, show.plots = TRUE)
```

### Arguments

`lscape.size` |
size (width = height) of the square landscape, including core and buffer. |

`buffer.width` |
width of buffer around core study area. |

`variance.X` |
variance of Gaussian random field (covariate X). |

`theta.X` |
scale parameter of correlation in field (must be >0). |

`M` |
expected number of activity centers in core area. |

`beta` |
coefficient of the habitat covariate. |

`quads.along.side` |
number of quadrats along the side of the core area; the total number of quadrats will be quads.along.side^2, thus indirectly defining the quadrat area. |

`show.plots` |
if TRUE, summary plots are displayed. |

### Value

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

`core` |
range of x and y coordinates in the 'core' |

`M2` |
number of ACs in the total landscape, including the buffer |

`grid` |
coordinates of the center of each pixel |

`pixel.size` |
length of side of each pixel |

`size.core` |
the width=height of the core area |

`prop.core` |
the proportion of the landscape inside the core |

`X` |
matrix of covariate values for each pixel |

`probs` |
matrix of probabilities of an AC being inside each pixel (sums to 1) |

`pixel.id` |
the ID of the pixel for each AC |

`u` |
2-column matrix, coordinate of each AC |

`nsite` |
number of quadrats |

`quad.size` |
width = height of each quadrat |

`breaks` |
boundaries of the quadrats |

`mid.pt` |
mid-points of the quadrats |

`lambda_pp` |
intensity of point pattern (ACs per unit area) |

`Nac` |
site-specific abundance of ACs |

`zac` |
site-specific occurrence (0/1) of ACs |

`E_N` |
average realized abundance per quadrat |

`E_z` |
average realized occupancy per quadrat |

### Author(s)

Marc Kéry & Andy Royle.

### References

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

### Examples

```
# Nice plot (produces the really nice Fig. 10-2 in the book)
# RNGkind(sample.kind = "Rounding") # run this for R >= 3.6.0
set.seed(117, kind="Mersenne-Twister")
# Fails if RandomFields is not available
#try(str(dat <- simPPe(lscape.size = 200, buffer.width = 25, variance.X = 1,
# theta.X = 70, M = 200, beta = 1, quads.along.side = 6)))
str(dat <- simPPe(lscape.size = 200, buffer.width = 20, variance.X = 1,
theta.X = 5, M = 250, beta = 1, quads.along.side = 6))
```

*AHMbook*version 0.2.9 Index]