racscovariance: Covariance Estimation

View source: R/racscovariance.R

racscovarianceR Documentation

Covariance Estimation


Estimates the covariance of a stationary RACS. The plug-in moment covariance estimator and newer balanced estimators based on (Picka, 1997; Picka, 2000) are available.


  obswin = NULL,
  setcov_boundarythresh = NULL,
  estimators = "all",
  drop = FALSE

  cpp1 = NULL,
  phat = NULL,
  estimators = "all",
  drop = FALSE



A binary map. Either an im object or a owin object. If an im object then pixel values of 1 or TRUE represent foreground, 0 or FALSE values represent background, and NA values represent outside the observation window. If an owin object then xi represents foreground and obswin is required to specify the observation window.


The observation window as an owin object if xi is also as an owin object.


To avoid instabilities caused by dividing by very small quantities, if the set covariance of the observation window is smaller than setcov_boundarythresh, then the covariance is given a value of NA.


A list of strings specifying covariance estimators to use. See details. Passing estimators = "all" will select all available estimators.


If TRUE and one estimator is selected then the returned value will be a single im object and not a list of im objects.


The plug-in moment estimate of covariance as an im object. Typically created with plugincvc.


Picka's reduced window estimate of coverage probability as an im object - used in improved (balanced) covariance estimators. Can be generated using cppicka.


The classical estimate of coverage probability, which is the observed area in xi divided by the total area of the observation window. See coverageprob for more information.


The covariance of a RACS is also known as the two-point coverage probability, and is closely related to the semivariogram. The covariance of a stationary RACS Ξ given a vector v is the probability that two points separated by a vector v are covered by Ξ.

Given a vector v, the plug-in moment covariance estimate from a binary map is the volume of the set of points, x, such that both x and x+v are observed to be in the foreground relative to the volume of points, x, for which both x and x+v are in the observation window (Hingee, 2019). Picka (1997, 2000) suggested a number of improvements to centred covariance estimation (see cencovariance) that 'balanced' the data used to estimate covariance with the data used to estimate coverage probability. These lead to covariance estimators that give estimates for the covariance of Ξ that are a constant offset from covariance estimates for the complement of Ξ (note the constant offset depends on the coverage probability), which appears to avoid some surprising behaviour that the plug-in moment covariance estimator suffers (Hingee, 2019). These estimators are called pickaint and pickaH in this package.

Another improved estimator, inspired by an 'intrinsic modification' briefly mentioned by Picka (1997) for pair-correlation estimators, is also available. We have called this estimator mattfeldt as a similar isotropic estimator for pair-correlation was studied by Mattfeldt and Stoyan (2000).

The estimators available are (see (Hingee, 2019) for more information):

  • plugin the plug-in moment covariance estimator

  • mattfeldt an estimator inspired by an 'intrinsically' balanced pair-correlation estimator from Picka that was later studied in an isotropic situation by Mattfeldt and Stoyan (2000)

  • pickaint an estimator inspired by an 'intrinsically' balanced centred covariance estimator from Picka (2000).

  • pickaH an estimator inspired by the 'additively' balanced centred covariance estimator from Picka (2000).


If drop = TRUE and only one estimator is requested then an im object containing the covariance estimate. Otherwise a named imlist of covariance estimates corresponding to each requested estimator.


  • racscovariance: Estimates covariance from a binary map.

  • racscovariance.cvchat: Computes covariance estimates from a plug-in moment estimate of covariance, Picka's reduced window estimate of coverage probability, and the usual estimate of coverage probability. If these estimates already exist then racscovariance.cvchat can save significant computation time.


Kassel Liam Hingee


Hingee, K.L. (2019) Spatial Statistics of Random Closed Sets for Earth Observations. PhD: Perth, Western Australia: University of Western Australia. Submitted.

Mattfeldt, T. and Stoyan, D. (2000) Improved estimation of the pair correlation function of random sets. Journal of Microscopy, 200, 158-173.

Picka, J.D. (1997) Variance-Reducing Modifications for Estimators of Dependence in Random Sets. Ph.D.: Illinois, USA: The University of Chicago.

Picka, J.D. (2000) Variance reducing modifications for estimators of standardized moments of random sets. Advances in Applied Probability, 32, 682-700.


xi <- heather$coarse
obswin <- Frame(xi)

# Estimate from a binary map
balancedcvchats_direct <- racscovariance(xi, obswin = obswin, estimators = "all")

phat <- coverageprob(xi, obswin = obswin)
cvchat <- plugincvc(xi, obswin)
cpp1 <- cppicka(xi, obswin = Frame(heather$coarse))
harmonised <- harmonise.im(cvchat = cvchat, cpp1 = cpp1)
cvchat <- harmonised$cvchat
cpp1 <- harmonised$cpp1

# Compute balanced estimate of covariance from other estimates
balancedcvchats_fromplugincvc <- racscovariance.cvchat(cvchat,
                         cpp1, phat, estimators = "pickaH", drop = TRUE)

lacunaritycovariance documentation built on March 18, 2022, 5:20 p.m.