CondSimu            package:RandomFields            R Documentation

_C_o_n_d_i_t_i_o_n_a_l _S_i_m_u_l_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     the function returns conditional simulations of a random field

_U_s_a_g_e:

     CondSimu(krige.method, x, y=NULL, z=NULL, grid,  model, param,
              method=NULL, n=1, register=0, gridtriple=FALSE, 
              err.model=NULL, err.param=NULL, err.method=NULL,
              err.register=1, given, data, tol=1e-05, pch=".")

_A_r_g_u_m_e_n_t_s:

krige.method: Assumptions on the random field which corresponds to the
          respective kriging method; currently only `"S"' (simple
          kriging) and `"O"' (ordinary kriging) possible.

       x: matrix or vector of `x' coordinates; points to be kriged.

       y: vector of `y' coordinates.

       z: vector of `z' coordinates.

    grid: logical; determines whether the vectors `x', `y', and `z'
          should be interpreted as a grid definition, see Details.

   model: string; covariance model of the random field.  See
          `CovarianceFct', or type `PrintModelList()' to get all
          options for `model'.

   param: parameter vector: `param=c(mean, variance, nugget,
          scale,...)'; the parameters must be given in this order;
          further parameters are to be added in case of a parametrised
          class of covariance functions, see `CovarianceFct'; the value
          of `mean' must be finite in the case of simple kriging, and
          is ignored otherwise.

  method: `NULL' or string; method used for simulating, see
          `RFMethods', or type `PrintMethodList()' to get all options.

       n: number of realisations to generate.

register: 0:9; place where intermediate calculations are stored; the
          numbers are aliases for 10 internal registers; see `GaussRF'
          for further details.

gridtriple: logical.  Only relevant if `grid==TRUE'.  If
          `gridtriple==TRUE' then `x', `y', and `z' are of the form
          `c(start,end,step)'; if `gridtriple==FALSE' then `x', `y',
          and `z' must be vectors of ascending values. 

err.model: string; covariance model that describes the measurement
          error.  See `CovarianceFct', or type `PrintModelList()' to
          get all options for `err.model'.  If `NULL' no measurement
          error is assumed. Currently, the only option for `err.model'
          is `"nugget"'. 

err.param: parameter vector: `err.param=c(mean, variance, nugget,
          scale,...)'; the parameters must be given in this order;
          further parameters are to be added in case of a parametrised
          class of covariance functions, see `CovarianceFct'; the value
          of `mean' must be finite in the case of simple kriging, and
          is ignored otherwise.  Since currently the only option for
          `err.model' is `"nugget"', `err.param' can only be of the
          form `c(mean,0,nugget,0)'. 

err.method: Currently, only `"nugget"' or `NULL' is sensible; see
          `method' for further information.

err.register: see `register' for details.

   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.

     tol: considered only if `grid=TRUE'; tolerated distances of a
          given point to the nearest grid point to be regarded as being
          zero; see Details.

     pch: character.  The included kriging procedure can be quite time
          consuming.  The character `pch' is printed after roughly each
          80th part of calculation.

_D_e_t_a_i_l_s:

     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 ly 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==FALSE)' : 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))')

_A_u_t_h_o_r(_s):

     Martin Schlather, Martin.Schlather@uni-bayreuth.de <URL:
     http://www.geo.uni-bayreuth.de/~martin>

_R_e_f_e_r_e_n_c_e_s:

     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.

_S_e_e _A_l_s_o:

     `CovarianceFct', `GaussRF', `Kriging' `RandomFields',

_E_x_a_m_p_l_e_s:

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

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

     image(x, x, cz, col=colour, xlim=lim, ylim=lim, zlim=zlim)

