[R-sig-eco] R algorithm/package for creating spatial autocorrelation of uniformly distributed landscape values
Colin Beale
cb751 at york.ac.uk
Tue May 11 08:16:00 CEST 2010
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:
> Dear all:
>
> I would like to create a landscape of environmental values that follow a
> uniform frequency distribution and also have spatial autocorrelation in the
> landscape. I was wondering if there is an algorithm and/or package out there
> that creates autocorrelation of values that are distributed according to a
> non-normal frequency distribution.
>
> Any suggestions are greatly appreciated.
>
> Thank you,
> Laura
>
--
Dr Colin Beale
Research Fellow
University of York
Mob. +255 (0) 684 059 123
More information about the R-sig-ecology
mailing list