Loading ...
Sorry, an error occurred while loading the content.
 

Re: [ai-geostats] Simulating an autocorrelated field

Expand Messages
  • Ruben Roa Ureta
    ... It is easy to simulate a Gaussian random field of given geometry with given spatial correlation function using the package RandomFields, in the free GNU
    Message 1 of 3 , Jun 13, 2005
      > Hi list,
      >
      > I need to generate a field f(x,y) with given variogram. More precisely, I
      > have N points (x,y) and I want to assign f(x,y) such that the variable f
      > has a spatial autocorrelation structure according to a given variogram
      > model.
      >
      > My impression is that the way to do it is simulated annealing, as
      > described in chapter 11 of the GSLIB manual. Is that correct ? Any other
      > methods ? Is there any easy-to-use & free software for this purpose ? Any
      > recommended literature ?

      It is easy to simulate a Gaussian random field of given geometry with
      given spatial correlation function using the package RandomFields, in the
      free GNU statistical system R. For example, i could make N.sim such random
      fields with a Gaussian variogram and save them all as text files with
      these lines of code:
      --------------
      mcolasim9<-function(N.sim){
      #Grid definition
      x<-seq(1,180,1)
      y<-seq(1,540,1)
      #Variogram model
      param<-c(6.63,2.24,1.82,4.36)
      #Major loop
      for(i in 1:N.sim){
      mcola<-GaussRF(x=x,y=y,param=param,grid=TRUE,model="gauss")
      file1.out<-paste("mcolasim9",i,"txt",sep=".")
      write(t(mcola),file1.out,ncol=ncol(t(mcola)))
      }
      }
      ---------------
      RandomFields will use simulated annealing if convenient but will use
      another method if this other method is best for the case at hand, and will
      select the method automatically. You can also force RandomFields to use a
      given method if you want.
      In R 2.1.0, from
      citation("RandomFields")
      i get
      Martin Schlather, (). RandomFields: Simulation and Analysis of
      Random Fields. R package version 1.2.16.
      http://www.unibw-hamburg.de/WWEB/math/schlath/schlather.html
      Cheers,
      Ruben
    Your message has been successfully submitted and would be delivered to recipients shortly.