Skip to content

generate simulation data for a theoretical spatial model

8 messages · Edzer Pebesma, Paulo Justiniano Ribeiro Jr, zhijie zhang +1 more

#
rusers.sh wrote:
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

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

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

            
#
It is dificult if not irrealistic to set Y to be 0/1 (ou interger counts 
or similar) in such model since this would impose severe contraints in the
a's and x's as well as in the model structure.

This is why the hierarquical model structure is one possible
working around. The ideia is the same as in generalised linear models 
relating the covariates (x's) and spatial effect to as function of the
expected value of Y instead of directly with Y.
In a "loose" notation:
Y_i ~ "some distribution" with E[Y_i] = \mu_i 
g(\mu_i) = a1*x1+a2*x2+spatial effect

where g() is a "convenient" function mapping (-Inf, +Inf)
to the parameter space of \mu_i

Some examples:

1. For binay (0/1) observations a possible model would be
Y_i ~ B(p_i)
log(p_i/(1-p_i) = a1*x1+a2*x2+spatial effect

2. For count data:
Y_i ~ B(\lambda_i)
log(\lambda_i) = a1*x1+a2*x2+spatial effect

3. For Gaussian data
Y_i ~ N(\mu_i, \tau^2)
\mu_i = a1*x1+a2*x2+spatial effect
which in this particular case can be written as
Y_i = a1*x1+a2*x2+spatial effect


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 Tue, 2 Feb 2010, rusers.sh wrote:

            
#
rusers.sh,

You can simulate stationary and isotropic Gaussian random fields ( and transformation of it)  as well as max-stable random fields
by using the RandomFields package.
To get a conditional simulation of the correlated residuals of a linear model
you can first simulate an unconditional realization (\mu = 0 and a given covariance structure),
 then choose the data location and make a simple kriging prediction of this realization. 
Now, take the difference between the unconditional simulation and the simple kriging prediction and you
get one realization of a simulated conditional error term. Now, if you add this term to  a kriging estimation
you get one conditional simulation.

You find a detail descripitoin of this procedure called "Conditioning by kriging" in the book
Geostatistics: Modeling Spatial Uncertainty ( 1999) of Chil?s, J.-P. and Delfiner, P



Sorry, for my bad english (I'm working on it).


Christoph


Am 03.02.2010 um 17:18 schrieb rusers.sh: