EmpiricalVariogram       package:RandomFields       R Documentation

_E_m_p_i_r_i_c_a_l (_S_e_m_i-)_V_a_r_i_o_g_r_a_m

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

     'EmpiricalVariogram' calculates the empirical (semi-)variogram of
     a random field realisation

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

     EmpiricalVariogram(x, y=NULL, z=NULL, T=NULL, data, grid, bin,
                        gridtriple=FALSE, phi, theta, deltaT)

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

       x: vector of x-coordinates, or matrix

       y: vector of y-coordinates

       z: vector of z-coordinates

       T: vector of time components; here T is given in grid format,
          see 'GaussRF'.

    data: vector or matrix of data; if 'data' has a multiple number of
          components as expected by the definition of the coordinates
          then it is assumed that the data stem from repeated,
          independent measurements at the given locations; the
          empirical variogram is calculated for the repeated data.

    grid: logical; if 'TRUE' then 'x', 'y', and 'z' define a grid;
          otherwise 'x', 'y', and 'z' are interpreted as points

     bin: vector of ascending values giving the bin boundaries

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

     phi: vector of two components. First component gives the angle for
          the first line of midpoints of an angular variogram. The
          second component gives the number of directions (on the half
          circle).  The spatial dimension must be at least 2. 

   theta: vector of two components. First component gives the angle for
          the first line of midpoints of an angular variogram (angle is
          zero for the xy-plane). The second component gives the number
          of directions (on the half circle).  The spatial dimension
          must be at least 3. 

  deltaT: vector of two components. First component gives the largest
          temporal distance; the second component the grid length, that
          must be a multiple of 'T[3]'. 

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

     Comments on specific parameters:

        *  'data': the number of values must match the number of points
           (given by 'x', 'y', 'z', 'grid', and 'gridtriple').  That
           is, it must equal the number of points or be a multiple of
           it.  In case the number of data equals n times the number of
           points, the data are interpreted as n independent
           realisations for the given set of points. 

        *  '(grid==FALSE)': the vectors 'x', 'y', and 'z', are
           interpreted as vectors of coordinates

        *  '(grid==TRUE) && (gridtriple==FALSE)': the vectors \
           code{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))')

        *  The bins are left open, right closed intervals, i.e.,
           ('b[i]','bin[i+1]'] for i=1,...,'length(bin)'-1.  Hence, to
           include zero, 'bin[1]' must be negative.

_V_a_l_u_e:

     The function returns a list: 

 centers: central points of the bins

emp.vario: empirical variogram; vector or matrix or array, depending on
          the anisotropy definitions. The sequence is distances, phi,
          theta, Tbins. If phi, theta, or Tbins below are not given,
          the respective dimensions are missing.

      sd: sd of the variogram cloud within each bin

   n.bin: number of points within a bin

     phi: vector of angles in xy plane

   theta: vector of angles in the third dimensions

   Tbins: vector of temporal distances


     The first four elements are vectors of length '(length(bin)-1)'.

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

     Martin Schlather, martin.schlather@cu.lu <URL:
     http://www.cu.lu/~schlathe>

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

     'GaussRF', 'mleRF, and \code{RandomFields}'

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

       #############################################################
       ## this example checks whether a certain simulation method ##
       ## works well for a specified covariance model and         ##
       ## a configuration of points                               ##
       #############################################################
       x <- seq(0, 10, 0.5)
       y <- seq(0, 10, 0.5)
       gridtriple <- FALSE      ## see help("GaussRF")
       model <- "whittle"       ## whittlematern
       bins <- seq(0, 5, 0.001)
       repetition <- 5 ## by far too small to get reliable results!!
                        ## It should be of order 500,
                        ## but then it will take some time
                        ## to do the simulations
       param <- c(mean=1, variance=10, nugget=5, scale=2, alpha=2)
       f <- GaussRF(x=x, y=y, grid=TRUE, gridtriple=gridtriple,
                       model=model, param=param, method="TBM3",
                       n=repetition)
       binned <- EmpiricalVariogram(x=x, y=y, data=f,
                      grid=TRUE, gridtriple=gridtriple, bin=bins)
       truevariogram  <- Variogram(binned$c, model, param)
       matplot(binned$c, cbind(truevariogram,binned$e), pch=c("*","e"))
       ##black curve gives the theoretical values

