Empirical (Cross-)Variogram

Description

Calculates the empirical (cross-)variogram. The empirical (cross-)variogram of two random fields X and Y is given by

γ(r):=1/2N(r) ∑_{(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

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

Arguments

x

matrix of coordinates, or vector of x coordinates, or object of class GridTopology or raster. If matrix, ncol(x) is the dimension of the index space. Matrix notation is required in case of more than 3 spatial dimensions; in this case, if grid=FALSE, x_ij is the i-th coordinate in the j-th dimension. Otherwise, if grid=TRUE, the columns of x are interpreted as gridtriples (see grid). if of class GridTopology , x is interpreted as grid definition and grid is automatically set to TRUE. Coordinates are not required if the data is an object of class RFsp, as these objects already contain its coordinates

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; the argument T is in an experimental stage.

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 z must be equidistant vectors in ascending order or the columns of x must be given in the gridtriple format c(from, stepsize, len) (see Details); Not required if data is of class RFsp

data

matrix, data.frame or object of class RFsp;

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 models; if not NULL, dim must be given and x, y, z and T must be missing or NULL.

vdim

the number of variables of a multivariate data set. If not given and data is an RFsp object created by RandomFields, the information there is taken from there. Otherwise vdim is assumed to be one.

NOTE: still the argument vdim is an experimental stage.

...

further options and control arguments for the simulation that are passed to and processed by RFoptions.

Details

RFempiricalvariogram computes the empirical cross-variogram for given (multivariate) spatial data.

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

Value

RFempiricalvariogram returns objects of class RFempVariog.

Author(s)

Sebastian Engelke, sebastian.engelke@unil.ch

Johannes Martini, jmartin2@uni-goettingen.de

Martin Schlather, schlather@math.uni-mannheim.de http://ms.math.uni-mannheim.de/de/publications/software

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again

n <- 1 ## use n <- 2 for better results

## isotropic model
model <- RMexp()
x <- seq(0, 10, 0.02)
z <- RFsimulate(model, x=x, n=n)
emp.vario <- RFempiricalvariogram(data=z)
plot(emp.vario, model=model)


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


## space-time model
model <- RMnsst(phi=RMexp(), psi=RMfbm(alpha=1), delta=2)
x <- seq(0, 10, 0.05)
T <- c(0, 0.1, 100)
z <- RFsimulate(x=x, T=T, model=model, n=n)
emp.vario <- RFempiricalvariogram(data=z, deltaT=c(10, 1))
plot(emp.vario, model=model, nmax.T=3)


## multivariate model
model <- RMbiwm(nudiag=c(1, 2), nured=1, rhored=1, cdiag=c(1, 5), 
                s=c(1, 1, 2))
x <- seq(0, 20, 0.1)
z <- RFsimulate(model, x=x, y=x, n=n)
emp.vario <- RFempiricalvariogram(data=z)
plot(emp.vario, model=model)


## multivariate and anisotropic model
model <- RMbiwm(A=matrix(c(1,1,1,2), nc=2),
                nudiag=c(0.5,2), s=c(3, 1, 2), c=c(1, 0, 1))
x <- seq(0, 20, 0.1)
data <- RFsimulate(model, x, x, n=n)
ev <- RFempiricalvariogram(data=data, phi=4)
plot(ev, model=model, boundaries=FALSE)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.