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

2012-06-01 Thread Hodgess, Erin
behalf of Edzer Pebesma Sent: Fri 6/1/2012 3:58 AM To: r-sig-geo@r-project.org Subject: Re: [R-sig-Geo] simulating a particular autocorrelation structure for a raster 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

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

2012-06-01 Thread Edzer Pebesma
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

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

2012-06-01 Thread Hodgess, Erin
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.