Learn R Programming

RandomFields (version 3.0.10)

RFempiricalvariogram: Empirical (Cross-)Variogram

Description

Calculates the empirical (cross-)variogram. The empirical (cross-)variogram of two random fields $X$ and $Y$ is given by $$\gamma(r):=\frac{1}{2N(r)} \sum_{(t_{i},t_{j})|t_{i,j}=r} (X(t_{i})-X(t_{j}))(Y(t_{i})-Y(t_{j}))$$ where $t_{i,j}:=t_{i}-t_{j}$, and where $N(r)$ denotes the number of pairs of data points with distancevector $t_{i,j}=r$.

Usage

RFempiricalvariogram(x, y = NULL, z = NULL, T = NULL, data, data2, grid,
 bin, phi, theta, deltaT, distances, ...)

Arguments

x
matrix of coordinates, or vector of x coordinates, or object of class GridTopology or raster. If matrix, ncol(x)<
y
optional vector of y coordinates, ignored if x is a matrix
z
optional vector of z coordinates, ignored if x is a matrix
T
optional vector of time coordinates, T must always be an equidistant vector or given in a gridtriple format (see grid); for each component of T, the random field is simulated at all location points
grid
logical; determines whether the vectors x, y, and z or the columns of x should be interpreted as a grid definition (see Details). If grid=TRUE, either x, y, and
data
matrix, data.frame or object of class RFsp;
data2
realisations of random field Y; If not specified, then data2=data which gives the variogram
bin
a vector giving the borders of the bins; If not specified an array describing the empirical (pseudo-)(cross-) variogram in every direction is returned.
phi
an integer defining the number of sectors one half of the X/Y plane shall be devided into. If not specified, either an array is returned (if bin missing) or isotropy is assumed (if bin specified)
theta
an integer defining the number of sectors one half of the X/Z plane shall be devided into. Use only for dimension $d=3$ if phi is already specified
deltaT
vector of length 2, specifying the temporal bins. The internal bin vector becomes seq(from=0, to=deltaT[1], by=deltaT[2])
distances
object of class dist representing the upper trianguar part of the matrix of Euclidean distances between the points at which the field is to be simulated; only applicable for stationary and isotropic mo
...
further options and control parameters for the simulation that are passed to and processed by RFoptions.

Value

Details

RFempiricalvariogram computes the empirical cross-variogram for given realisations of two random fields (X= data, Y= data2). If data2 is missing the variogram of X will be calucalted (Y=X).

The spatial coordinates x,y,z should be vectors. For random fields of spatial dimension d > 3 write all vectors as colums of matrix x. In this case do neither use y, nor z and write the colums in gridtriple notation.

If the data is spatially located on a grid a fast algorithm based on the fast Fourier transformed (fft) will be used. As advanced option the calculation method can also be changed for grid data (see RFoptions.) It is also possible to use RFempiricalvariogram to calulate the pseudovariogram(see RFoptions).

References

Gelfand, A. E., Diggle, P., Fuentes, M. and Guttorp, P. (eds.) (2010) Handbook of Spatial Statistics. Boca Raton: Chapman & Hall/CRL.

Stein, M. L. (1999) Interpolation of Spatial Data. New York: Springer-Verlag

See Also

RMstable, RMmodel, RFsimulate, RFfit.

Examples

Run this code
RFoptions(seed=0)
model <- RMexp()
x <- seq(0, 10, if (interactive()) 0.02 else 1) 
z <- RFsimulate(model, x=x)
emp.vario <- RFempiricalvariogram(data=z)
plot(emp.vario, model=model)

model <- RMexp(Aniso=cbind(c(2,1), c(1,1)))
x <- seq(0, 10, if (interactive()) 0.05 else 1)
z <- RFsimulate(x=x, y=x, model=model)
emp.vario <- RFempiricalvariogram(data=z, phi=4)
plot(emp.vario, model=model)

model <- RMexp()
x <- seq(0, 10, if (interactive()) 0.05 else 1)
T <- c(0, if (interactive()) 0.1 else 1, if (interactive()) 100 else 10)
z <- RFsimulate(x=x, T=T, model=model)
emp.vario <- RFempiricalvariogram(data=z, deltaT=c(10, 1))
plot(emp.vario, model=model, nmax.T=3)

RFoptions(seed=NA)

Run the code above in your browser using DataLab