simSpatialDSline {AHMbook} | R Documentation |

This simulates line transect distance sampling data with a spatial distribution of objects in a heterogeneous landscape where the parameter beta controls the effect of habitat. Habitat is simulated according to a Gaussian random field model defined within the function. Uses a half normal detection model (if perp = TRUE) or a Gaussian hazard model (perp = FALSE).

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.

simSpatialDSline(N=1000, beta = 1, sigma=0.25, alpha0 = -2, W=1/2, L = 4, perp=FALSE, show.plots=TRUE)

`N` |
total population size in the rectangle |

`beta` |
coefficient of spatial covariate x for the density model. |

`sigma` |
scale of half-normal detection function |

`alpha0` |
intercept of the hazard function. |

`W` |
half-width of the rectangle, which extends W each side of the transect line. |

`L` |
length of the transect. |

`perp` |
if TRUE, data are simulated for a traditional distance sampling model with perpendicular distances; if FALSE (the default) a model with 'forward distance' data, ie, the distance from the observer to the animal on first detection. |

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

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

`delta ` |
the distance between pixel centers (spatial resolution of the raster |

`grid ` |
2-column matrix with x/y coordinates of all pixels |

`Habitat ` |
value of habitat covariate for each pixel |

`Habraster ` |
a Raster object with the habitat covariate |

`u1, u2 ` |
x and y coordinates for all the animals in the population |

`traps ` |
2-column matrix of trap locations |

If `perp = TRUE`

we have

`data ` |
a 2-column matrix with x and y coordinates of each animal captured. |

`pixel ` |
pixel ID for each animal captured. |

and if `perp = FALSE`

we have

`data ` |
a matrix with rows for each animal captured and columns for trap of first capture, distance from trap to animal, and x and y coordinates of the animal. |

`pbar ` |
probability that each animal is the population is captured at least once |

`pixel ` |
pixel ID for each animal captured. |

Marc Kéry & Andy Royle

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

# Run the function with default values and look at the output str(tmp <- simSpatialDSline(), 1) # use str(., max.level=1) to limit the amount of output.

[Package *AHMbook* version 0.2.3 Index]