Simulate spatially auto-correlated data using Gaussian random fields.

simulate_data(
  x,
  n = 1,
  scale = 0.5,
  intensity = 0,
  sd = 1,
  transform = identity
)

Arguments

x

raster::raster() raster object to use as a template.

n

integer number of layers to simulate. Defaults to 1.

scale

numeric parameter to control level of spatial auto-correlation. Defaults to 0.5.

intensity

numeric average value of simulated data. Defaults to 0.

sd

numeric standard deviation of simulated data. Defaults to 1.

transform

function transform values output from the simulation. Defaults to the identity() function such that values remain the same following transformation.

Value

raster::stack() object.

Examples

# \dontrun{
# create raster
r <- raster(ncol = 10, nrow = 10, xmn = 0, xmx = 1, ymn = 0, ymx = 1)
values(r) <- 1

# simulate data using a Gaussian field
x <- simulate_data(r, n = 1, scale = 0.2)

# plot simulated data
plot(x, main = "simulated data")

# }