R: Empirical variogram

asr_varioGram {asreml} | R Documentation

## Empirical variogram

### Description

Calculates the empirical variogram from regular or irregular one- or two-dimensional data.

### Usage

    asr_varioGram(
      x,
      y,
      z,
      composite = TRUE,
      model = c("empirical"),
      metric = c("euclidean", "manhattan"),
      angle = 0,
      angle.tol = 180,
      nlag = 20,
      maxdist = 0.5,
      xlag = NA,
      lag.tol = 0.5,
      grid = TRUE,
      ...
    )

### Arguments

`x` | Numeric vector of x coordinates, may also be a matrix or data frame with two or three columns. If `ncol(x)` is three, the columns are taken to be the x and y coordinates and the response (z), respectively. If `ncol(x)` is two, the columns are taken to be the x coordinates and the response, respectively. In this case the y coordinates are generated as `rep(1, nrow(x))`.
`y` | Numeric vector of y coordinates.
`z` | The response vector.
`composite` | To be used for data on a regular grid. If `TRUE`, the average of the variograms in quadrants (x, y) and (x, -y) is returned. Otherwise, both variograms are returned and identified as quadrants 1 and 4 (default = `TRUE`).
`model` | At the present, it can only be `"empirical"`.
`metric` | The distance between (x, y) points. Options are: `"euclidean"` or `"manhattan"` (default = `"euclidean"`).
`angle` | A vector of directions. Angles are measured in degrees anticlockwise from the x axis (default = `0`).
`angle.tol` | The angle subtended by each direction. That is, an arc `angle +/- angle.tol/2` (default = `180`, which gives an omnidirectional variogram).
`nlag` | The maximum number of lags (default = `20`).
`maxdist` | The fraction of the maximum distance to include in the calculation. The default is half the maximum distance in the data: `0.5`.
`xlag` | The width of the lags. If missing, `xlag` is set to `maxdist/nlag`.
`lag.tol` | The distance tolerance (default = `0.5`).
`grid` | If `FALSE`, forces polar variograms if (x, y) specifies a regular grid (default = `TRUE`).
`...` | Additional arguments, for example `core_version`.

### Details

For one-dimensional data the y coordinates need not be supplied and a vector of ones is generated. The function identifies data on a complete regular array and in such cases only computes polar variograms if `grid = FALSE`. The data are assumed sorted with the x coordinates changing the fastest; the data are sorted internally if this is not the case.

### Value

A data frame including the following components:

- `x`: The original x coordinates.

- `y`: The original y coordinates.

- `gamma`: The variogram estimate.

- `distance`: The average distance for pairs in the lag.

- `np`: The number of pairs in the lag.

- `angle`: Direction if not a regular grid.

[Package asreml version 4.2.0.480 Index]