simExpCorrRF | R Documentation |
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"))
.
simExpCorrRF(variance = 1, theta = 1, size = 50, seed = NA, show.plots = TRUE)
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. |
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 |
Marc Kéry & Andy Royle
Kéry, M. & Royle, J.A. (2021) Applied Hierarchical Modeling in Ecology AHM2 - 9.
# Run the function with default values and look at the output
str(tmp <- simExpCorrRF())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.