Just to add that besides unconditional simulation as discussed there are some functionality for conditional simulations is some packages. Is geoR the functions krige.conv() and krige.bayes() have an option for that and in geoRglm the krige.binom(), krige.pois() or krige.glsm() also does that. Except the first in geoR, the functions implements predictions under the Bayesian paradigma relying on (conditional) simulations in their algorithms. The algorithms have an argument to "keep" the simulations on the resulting object. They are based on the approach of assuming an hierarquical spatial model with an underlying (latent) Gaussian field $S$ (even when the responses $Y$ are no Gaussian) and the conditional simulatios are for such latent field from which simulations on the scale of the response variable can be obtained if wished under the conditional independence of the responses $Y$ given $S$.

Paulo Justiniano Ribeiro Jr
LEG (Laboratorio de Estatistica e Geoinformacao)
Universidade Federal do Parana
Caixa Postal 19.081
CEP 81.531-990
Curitiba, PR  -  Brasil
Tel: (+55) 41 3361 3573
Fax: (+55) 41 3361 3141
e-mail: paulojus AT  ufpr  br
http://www.leg.ufpr.br/~paulojus



On Wed, 3 Feb 2010, Edzer Pebesma wrote:

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.pebe...@uni-muenster.de <mailto:edzer.pebe...@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 <he...@spatial-analyst.net
        <mailto:he...@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@stat.math.ethz.ch
            <mailto:R-sig-Geo@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.pebe...@wwu.de
    <mailto:e.pebe...@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.pebe...@wwu.de

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to