[R] Simulating a landscape (matrix) in R
Edzer J. Pebesma
e.pebesma at geog.uu.nl
Fri Jun 4 12:39:29 CEST 2004
For creating larger "landscapes" (Gaussian random fields), you may
consider using package gstat, which uses the sequential Gaussian simulation
algorithm with local approximations. In the example below, only the nearest
20 neighbours are used to approximate each of the conditional distributions.
The example below which simulates & plots a 300x300 grid, took 1 minute
on a 2 GHz CPU.
Best regards,
--
Edzer
library(gstat)
g = gstat(NULL, "id0", z~1, ~x+y, dummy=TRUE,nmax=20,
model=vgm(1,"Exp",500),beta=10)
locs=expand.grid(x=1:300,y=1:300)
out <- predict.gstat(g, locs, nsim=1)
levelplot(sim1~x+y,out,col.regions=bpy.colors())
More information about the R-help
mailing list