Skip to contents

Compares the mark correlation of the data with those of nsim random permutations of the marks (Diggle 2003; mad.test and dclf.test with simulate = rlabel in spatstat). The discrepancy is the largest ("mad") or integrated squared ("dclf") deviation of \(k_{mm}\) from 1 over rmin <= r <= rmax (the integral is (rmax - rmin) times the mean squared deviation, as spatstat); p-value (1 + number of simulated T >= observed T) / (nsim + 1). Permutations are Fisher-Yates shuffles from Philox stream s of seed, identical to the Python arm.

Usage

MarkDependenceTest(
  points,
  marks,
  window,
  nsim = 99L,
  seed = 1L,
  statistic = "mad",
  rmin = 0,
  rmax = NULL,
  correction = "iso"
)

Arguments

points

Two-column matrix of coordinates.

marks

Non-negative numeric marks.

window

c(xmin, xmax, ymin, ymax).

nsim

Number of relabellings.

seed

Philox seed.

statistic

"mad" or "dclf".

rmin

Smallest distance in the discrepancy.

rmax

Largest distance for the default r.

correction

"iso" or "trans".

Value

List with statistic, p_value, simulated, nsim, r, k, method.

References

Diggle, P. J. (1986). Displaced amacrine cells in the retina of a rabbit: analysis of a bivariate spatial point pattern. Journal of Neuroscience Methods 18, 115-125.

Diggle, P. J. (2003). Statistical Analysis of Spatial Point Patterns, 2nd edn. Arnold, London.

Examples

P <- cbind(c(.1, .4, .35, .8, .7, .55, .2, .9, .15, .6), c(.2, .8, .3, .6, .15, .5, .65, .9,
  .95, .85))
MarkDependenceTest(P, c(1, 2, 1.5, 3, .5, 2.5, 1, 2, .8, 1.2), c(0, 1, 0, 1), nsim = 19)$p_value
#> [1] 1