[R-sig-Geo] simulating a particular autocorrelation structure for a raster

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Jun 1 10:58:58 CEST 2012


Erin, I believe the following would do this:

xy = expand.grid(x = 1:16, y = 1:16)
d = as.matrix(dist(xy))
sim = chol(0.9 ^ d) %*% rnorm(256)

require(sp)
grd = SpatialPointsDataFrame(SpatialPoints(xy), data.frame(sim=sim))
gridded(grd) = TRUE
spplot(grd, col.regions=bpy.colors())

I used distance instead of closeness, so the diagional neighbour cell
gets autocorrelation 0.9 ^ sqrt(2), instead of 0.9 ^ 2 as you suggest.

To me, the simulations look really funny, so either my procedure is
wrong, or the covariance structure as you suggested (or I interpreted)
has strange properties in 2D.


On 06/01/2012 09:54 AM, Hodgess, Erin wrote:
> Dear R Sig Geo People:
> 
> I would like to create a 16x16 raster, say, with autocorrelation structure of 0.9 for nearest cell, 0.9^2 for 2nd closest, and so on.
> 
> How would I go about generating that, please?
> 
> I thought about putting together a correlation matrix, multiplying, and throwing in rnorm.  But I'm sure that there is something better and easier already in place.
> 
> Thanks in advance for any help.
> 
> Sincerely,
> Erin
> 
> 
> Erin M. Hodgess, PhD
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: hodgesse at uhd.edu
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list