simExpCorrRF {AHMbook} | R Documentation |
Create a Gaussian random field with negative exponential correlation
Description
Function creates Gaussian random field with negative exponential correlation and visualizes correlation and random field.
Previous versions used RandomFields, but that is not currently available on CRAN. fields is now used instead, but it cannot deal with large values of size
and theta
. If you have RandomFields installed (perhaps by getting it from the CRAN archive), you can load a version of simExpCorrRF
that supports it with source(system.file("RandomFieldsSupport", "simExpCorrRF.R", package="AHMbook"))
.
Usage
simExpCorrRF(variance = 1, theta = 1, size = 50, seed = NA, show.plots = TRUE)
Arguments
variance |
variance of field. |
theta |
parameter governing spatial correlation (=1/phi) ("large theta means high correlation") Note that RMexp (which is used internally) is specified in terms of phi = 1/theta. |
size |
number of pixels along each side of the square site. |
seed |
used to generate reproducible output. |
show.plots |
if TRUE, the result will be displayed. |
Value
A list with the values of the input arguments and the following additional elements:
field |
the random field variable, a vector of length size^2 |
grid |
the grid corresponding to field |
Author(s)
Marc Kéry & Andy Royle
References
Kéry, M. & Royle, J.A. (2021) Applied Hierarchical Modeling in Ecology AHM2 - 9.
Examples
# Run the function with default values and look at the output
str(tmp <- simExpCorrRF())