R: Estimate the Spatial Covariance Function of a Random Field

spatcov {spatstat.core} | R Documentation

## Estimate the Spatial Covariance Function of a Random Field

### Description

Given a pixel image, calculate an estimate of the spatial covariance function. Given two pixel images, calculate an estimate of their spatial cross-covariance function.

### Usage

    spatcov(X, Y=X, ..., correlation=FALSE, isotropic = TRUE,
            clip = TRUE, pooling=TRUE)

### Arguments

`X` | A pixel image (object of class `"im"`).
`Y` | Optional. Another pixel image.
`correlation` | Logical value specifying whether to standardise so that the spatial correlation function is returned.
`isotropic` | Logical value specifying whether to assume the covariance is isotropic, so that the result is a function of the lag distance.
`clip` | Logical value specifying whether to restrict the results to the range of spatial lags where the estimate is reliable.
`pooling` | Logical value specifying the estimation method when `isotropic=TRUE`.
`...` | Ignored.

### Details

In normal usage, only the first argument `X` is given. Then the pixel image `X` is treated as a realisation of a stationary random field, and its spatial covariance function is estimated.

Alternatively if `Y` is given, then `X` and `Y` are assumed to be jointly stationary random fields, and their spatial cross-covariance function is estimated.

For any random field `X`, the spatial covariance is defined for any two spatial locations u and v by

C(u,v) = cov(X(u), X(v))

where X(u) and X(v) are the values of the random field at those locations. Herecov denotes the statistical covariance, defined for any random variables A and B by cov(A,B) = E(AB) - E(A) E(B) where E(A) denotes the expected value of A.

If the random field is assumed to be stationary (at least second-order stationary) then the spatial covariance C(u,v) depends only on the lag vector v-u:

C(u,v) = C_2(v-u)

C(u,v) = C2(v-u)

where C2 is a function of a single vector argument.

If the random field is stationary and isotropic, then the spatial covariance depends only on the lag distance ||v-u||:

C2(v-u) = C1(||v-u||)

where C1 is a function of distance.

The function `spatcov` computes estimates of the covariance function C1 or C2 as follows:

- If `isotropic=FALSE`, an estimate of the covariance function C2 is computed, assuming the random field is stationary, using the naive moment estimator, `C2 = imcov(X-mean(X))/setcov(Window(X))`. The result is a pixel image.

- If `isotropic=TRUE` (the default) an estimate of the covariance function C1 is computed, assuming the random field is stationary and isotropic.

  - When `pooling=FALSE`, the estimate of C1 is the rotational average of the naive estimate of C2.

  - When `pooling=TRUE` (the default), the estimate of C1 is the ratio of the rotational averages of the numerator and denominator which form the naive estimate of C2.

  The result is a function object (class `"fv"`).

If the argument `Y` is given, it should be a pixel image compatible with `X`. An estimate of the spatial cross-covariance function between `X` and `Y` will be computed.

### Value

If `isotropic=TRUE` (the default), the result is a function value table (object of class `"fv"`) giving the estimated values of the covariance function or spatial correlation function for a sequence of values of the spatial lag distance `r`.

If `isotropic=FALSE`, the result is a pixel image (object of class `"im"`) giving the estimated values of the spatial covariance function or spatial correlation function for a grid of values of the spatial lag vector.

### Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au

### See Also

`imcov`, `setcov`

### Examples

    if(offline <- !interactive()) op <- spatstat.options(npixel=32)

      D <- density(cells)
      plot(spatcov(D))

    if(offline) spatstat.options(op)

[Package spatstat.core version 2.3-0 Index]