Skip to content

R algorithm/package for creating spatial autocorrelation of uniformly distributed landscape values

2 messages · Laura S, Colin Beale

#
Hmmm, that's not a trivial problem. package geoRglm has functions to 
generate Poisson and Binomial surfaces. RandomFields is remarkably 
flexible. But there are good reasons why a uniform distribution is 
challenging to produce from a given spatial structure (think of 
'natural' autocorrelation as waves on the sea - there are only ever 
going to be a few high values and a few low values). So I don't know of 
any packages that do this 'off the shelf' - it really doesn't correspond 
to many real landscape covariates anyway, so are you sure you want to 
simulate such a landscape? If you are, I think I'd generate my uniform 
distribution using runif(), and then allocate values from this vector to 
some spatially autocorrelated structure generated with RandomFields 
using sort and order - something like:

library(RandomFields)
#Generate a sorted vector of uniform distribution of required length:
my.unifdist <- sort(runif(20*20))
#Generate a landscape of autocorrelated values:
my.landscape <- GaussRF (1:20,1:20,param = c(0,5,1,10),
               method = "cutoff CE", model = "exponential", grid = T)
#Place the sorted vector in the rank order of the landscape values:
my.uniflandscape <- matrix(my.unifdist[rank(my.landscape)], ncol
                      = 20)
#Have a look at the landscapes:
par(mfrow = c(1,2))
image(my.landscape, main = "Gaussian landscape")
image(my.uniflandscape, main = "Uniform Landscape")

It's autocorrelated, and has a uniform distribution, but has a rather 
warped autocorrelation structure. Are you sure this is the sort of 
landscape you want to simulate?

Colin
Laura S wrote: