Learn R Programming

spatstat.explore (version 3.1-0)

spatcov: 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)

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.

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.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au

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) = \mbox{cov}(X(u), X(v)) $$ where \(X(u)\) and \(X(v)\) are the values of the random field at those locations. Here\(\mbox{cov}\) denotes the statistical covariance, defined for any random variables \(A\) and \(B\) by \(\mbox{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 \(C_2\) 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 \|\): $$ C_2(v-u) = C_1(\|v-u\|) $$ where \(C_1\) is a function of distance.

The function spatcov computes estimates of the covariance function \(C_1\) or \(C_2\) as follows:

  • If isotropic=FALSE, an estimate of the covariance function \(C_2\) 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 \(C_1\) is computed, assuming the random field is stationary and isotropic.

    • When pooling=FALSE, the estimate of \(C_1\) is the rotational average of the naive estimate of \(C_2\).

    • When pooling=TRUE (the default), the estimate of \(C_1\) is the ratio of the rotational averages of the numerator and denominator which form the naive estimate of \(C_2\).

    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.

See Also

imcov, setcov

Examples

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

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

if(offline) spatstat.options(op)

Run the code above in your browser using DataLab