CondSimu {RandomFields} | R Documentation |
the function returns conditional simulations of a Gaussian random field
CondSimu(krige.method, x, y=NULL, z=NULL, T=NULL, grid, gridtriple=FALSE, model, param, method=NULL, given, data, trend, n=1, register=0, err.model=NULL, err.param=NULL, err.method=NULL, err.register=1, tol=1E-5, pch=".", paired=FALSE, na.rm=FALSE)
krige.method |
Assumptions on the random field which corresponds to the respective kriging method; currently 'S' (simple kriging) and 'O' (ordinary kriging) are implemented. |
x |
matrix or vector of |
y |
vector of |
z |
vector of |
T |
vector in grid triple form for the time coordinates. |
grid |
logical; determines whether the vectors |
gridtriple |
logical. Only relevant if |
model |
string; covariance model of the random field.
See See |
param |
parameter vector:
See |
method |
|
given |
matrix or vector of locations where data are available; note that it is not possible to give the points in form of a grid definition. |
data |
the values measured. |
trend |
Not programmed yet. (used by universal kriging) |
n |
number of realisations to generate. If |
register |
0:9; place where intermediate calculations are stored;
the numbers are aliases for 10 internal registers; see
|
err.model |
covariance function for the error model. String or list.
See |
err.param |
parameters for the error model. See also
|
err.method |
Only relevant if |
err.register |
see |
tol |
considered only if |
pch |
character.
The included kriging procedure can be quite time consuming.
The character |
paired |
logical.
logical. If |
na.rm |
logical. If |
The same way as GaussRF
the function
CondSimu
allows for simulating on grids or arbitrary
locations. However simulation on a grid is sometimes performed
as if the points were at arbitrary locations, what may
imply a great reduction in speed. This happens when the given
locations do not lay on the specified grid, since in an intermediate
step simulation has to be performed simultaneously on both the grid
defined by x
, y
, z
, and the locations
of given
.
Comments on specific parameters
grid=FALSE
: the vectors x
, y
,
and z
are interpreted as vectors of coordinates
(grid=TRUE) && (gridtriple=FALSE)
: the vectors
x
, y
, and z
are increasing sequences with identical lags for each sequence.
A corresponding
grid is created (as given by expand.grid
).
(grid=TRUE) && (gridtriple=TRUE)
: the vectors
x
, y
, and z
are triples of the form (start,end,step) defining a grid
(as given by expand.grid(seq(x$start,x$end,x$step),
seq(y$start,y$end,y$step),
seq(z$start,z$end,z$step))
)
The returned object depends on the parameters n
and
grid
:
n=1
:
* grid=FALSE
. A vector of simulated values is
returned (independent of the dimension of the random field)
* grid=TRUE
. An array of the dimension of the
random field is returned.
n>1
:
* grid=FALSE
. A matrix is returned. The columns
contain the realisations.
* grid=TRUE
. An array of dimension
d+1, where d is the dimension of
the random field as given by x
, y
, and z
,
is returned. The last dimension contains the realisations.
Martin Schlather, martin.schlather@math.uni-goettingen.de http://www.stochastik.math.uni-goettingen.de/~schlather
Chiles, J.-P. and Delfiner, P. (1999) Geostatistics. Modeling Spatial Uncertainty. New York: Wiley.
Cressie, N.A.C. (1993) Statistics for Spatial Data. New York: Wiley.
Goovaerts, P. (1997) Geostatistics for Natural Resources Evaluation. New York: Oxford University Press.
Wackernagel, H. (1998) Multivariate Geostatistics. Berlin: Springer, 2nd edition.
CovarianceFct
,
GaussRF
,
Kriging
RandomFields
,
## creating random variables first ## here, a grid is chosen, but any arbitrary points for which ## data are given are fine. Indeed if the data are given on a ## grid, the grid has to be expanded before calling `CondSimu', ## see below. ## However, locations where values are to be simulated, ## should be given in form of a grid definition whenever ## possible param <- c(0, 1, 0, 1) model <- "exponential" RFparameters(PracticalRange=FALSE) p <- 1:7 data <- GaussRF(x=p, y=p, grid=TRUE, model=model, param=param) for (i in 1:3) do.call(getOption("device"), list(height=4,width=4)) # another grid, where values are to be simulated step <- 0.25 # or 0.3 x <- seq(0, 7, step) # standardisation of the output lim <- range( c(x, p) ) zlim <- c(-2.6, 2.6) colour <- rainbow(100) ## visualise generated spatial data dev.set(2) image(p, p, data, xlim=lim, ylim=lim, zlim=zlim, col=colour) #conditional simulation krige.method <- "O" ## random field assumption corresponding to ## those of ordinary kriging cz <- CondSimu(krige.method, x, x, grid=TRUE, model=model, param=param, given=expand.grid(p,p),# if data are given on a grid # then expand the grid first data=data) range(cz) dev.set(3) image(x, x, cz, col=colour, xlim=lim, ylim=lim, zlim=zlim) #conditional simulation with error term cze <- CondSimu(krige.method, x, x, grid=TRUE, model=model, param=c(0, 1/2, 0, 1), err.model="gauss", err.param=c(0, 1/2, 0, 1), given=expand.grid(p,p), data=data) range(cze) dev.set(4) image(x, x, cze, col=colour, xlim=lim, ylim=lim, zlim=zlim)