[R-sig-Geo] generate simulation data for a theoretical spatial model

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Feb 3 07:54:45 CET 2010


rusers.sh,

demo(ugsim)

in package gstat gives an example how to generate unconditional Gaussian 
simulations. Specifying the covariates in a formula and the parameter 
vector beta will add a deterministic trend to that.

If, in addition to that, you want unconditionally simulated residuals 
added to a trend effect that is simulated as well, look at rmvnorm in 
package mvtnorm how to generate realisations from the multivariate 
normal distribution with given mean and covariance; finally, combine the 
two.
--
Edzer

rusers.sh wrote:
>   It works. The problem is that it only generates the simulated data 
> based on our observed dataset,e.g. "meuse" here. 
>   I wonder if we can generate the simulated dataset from the 
> user-specified model with covariates included, such as 
> y~a1*x1+a2*x2+spatial effect. Y can be continuous or 0/1 variables. 
> Something like this.
>   The idea is we first specify a theoretical model, and then generate 
> the simulated data based on this model. The coefficients and spatial 
> effects are fixed by users, so we may study some new methods.
>   Thanks.
>
> 2010/2/2 Edzer Pebesma <edzer.pebesma at uni-muenster.de 
> <mailto:edzer.pebesma at uni-muenster.de>>
>
>
>
>     rusers.sh wrote:
>
>         Hi Tomislav,
>          Thanks for your info on unconditional simulation. For conditional
>         simulations, i still cannot find any useful information.
>          I searched the R site and didnot find the possible method to do
>         conditional simulations.
>         1. CondSimu(RandomField): trend: Not programmed yet. (used by
>         universal
>         kriging)
>         2. grf(geoR): generates unconditional simulations of Gaussian
>         random fields
>         3. sim.Krig(fields)  #Conditonal simulation of a spatial process
>           It seems to be based on the actual dataset,not a theoretical
>         model.
>         4. krige(gstat ):Simple, Ordinary or Universal, global or
>         local, Point or
>         Block Kriging,or simulation
>          x <- krige(log(zinc)~x+y, meuse, meuse.grid, model = m, block =
>         c(40,40),nsim=1)
>          
>
>     rusers.sh, please use
>
>     x <- krige(log(zinc)~x+y, meuse, meuse.grid, model = m, nmax=40,
>     nsim=1)
>
>     both adding the block=c(40,40) as well as omitting the nmax=40
>     tremendously increased the computing time you needed, the second
>     even more (in an O(n^2) manner) than the first.
>     --
>     Edzer
>
>
>
>
>          I used the above modified codes from krige(gstat ) example to
>         see the
>         effect of "nsim", but unfortunately, it took a longer time and
>         cannot get
>         the results. I guess it used the simulation method to test the
>         model, not
>         what i want. (My system is XP, R2.10.0, gstat09.-64.)
>          Anybody can give me further information on generating the
>         conditional
>         simulations from a theoretical model just like the
>         unconditional examples
>         that Tomislav provided?
>          Thanks a lot.
>
>
>         2010/1/31 Tomislav Hengl <hengl at spatial-analyst.net
>         <mailto:hengl at spatial-analyst.net>>
>
>          
>
>             Dear rusers.sh,
>
>             Here are few simple examples of how to simulate (not-normal)
>             distributions and point processes using geoR and spatstat:
>
>             http://spatial-analyst.net/book/node/388
>
>             See also:
>
>
>             http://leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose8.html#x9-120008
>
>             I guess that covariates can be also included (I guess that
>             you then need
>             to switch to conditional simulations - not sure).
>
>             This should also work for lattice (polygon) data so that
>             you will have
>             jumps in values (but I guess you would still work in
>             gridded systems?).
>
>             T. Hengl
>             http://home.medewerker.uva.nl/t.hengl/
>
>
>             rusers.sh wrote:
>
>                
>
>                 Hi all,
>                  In classical statistics, we always need to generate a
>                 theoretical model
>                 such as y=a+b1*x1+b2*x2+e to study some new estimation
>                 content. I am
>                 wondering how to generate the similar spatial dataset
>                 for a theoretical
>                 model.
>                 Say y is response variable, x1 and x2 are explanatory
>                 variables.
>                 1. If y is a continous variable, how should we
>                 generate the dataset for a
>                 theoretical spatial point process model in R?
>                 2. If y is a continous variable, how should we
>                 generate the dataset for a
>                 theoretical spatial lattice data model in R?
>                 3. If y is 0/1 binary variable, how should we generate
>                 the dataset for a
>                 theoretical spatial point process model in R?
>                 4. If y is 0/1 binary variable, how should we generate
>                 the dataset for a
>                 ttheoretical spatial lattice data in R?
>                  spatstat and other packages allow us to generate a
>                 dataset of a specified
>                 point process and other models, but it seems that they
>                 donot allow us to
>                 include possible explanatory variables into a
>                 theoretical model. Maybe i
>                 missed some ideas in them.
>                  Anybody can express some ideas or point out some
>                 useful resources on the
>                 above four different situations? Small examples in R
>                 are preferred.
>                  Thanks a lot.
>
>
>                      
>
>             _______________________________________________
>             R-sig-Geo mailing list
>             R-sig-Geo at stat.math.ethz.ch
>             <mailto:R-sig-Geo at stat.math.ethz.ch>
>             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
>     <mailto:e.pebesma at wwu.de>
>
>
>
>
> -- 
> -----------------
> Jane Chang
> Queen's

-- 
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