# RFmadogram: Empirical (Cross-)Madogram In RandomFields: Simulation and Analysis of Random Fields

## Description

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

γ(r):=1/N(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 3``` ```RFmadogram(model, x, y=NULL, z=NULL, T=NULL, grid, params, distances, dim, ..., data, bin=NULL, phi=NULL, theta = NULL, deltaT = NULL, vdim=NULL) ```

## Arguments

 `model,params` \argModel `x` \argX `y,z` \argYz `T` \argT `grid` \argGrid `distances,dim` \argDistances `...` \argDots `data` \argData `bin` \argBin `phi` \argPhi `theta` \argTheta `deltaT` \argDeltaT `vdim` \argVdim

## Details

`RFmadogram` computes the empirical cross-madogram 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 columns of matrix x. In this case do neither use y, nor z and write the columns 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 `RFmadogram` to calculate the pseudomadogram (see `RFoptions`).

## Value

`RFmadogram` returns objects of class `RFempVariog`.

## Author(s)

Jonas Auel; Sebastian Engelke; Johannes Martini; \martin

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

`RMstable`, `RMmodel`, `RFsimulate`, `RFfit`, `RFcov`, `RFpseudomadogram`. `RFvariogram`.
 ``` 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 <- RFmadogram(data=z) plot(emp.vario) ## 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 <- RFmadogram(data=z, phi=4) plot(emp.vario) ## 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 <- RFmadogram(data=z, deltaT=c(10, 1)) plot(emp.vario, 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 <- RFmadogram(data=z) plot(emp.vario) ## 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) dta <- RFsimulate(model, x, x, n=n) ev <- RFmadogram(data=dta, phi=4) plot(ev, boundaries=FALSE) ```