SpatialRandomnessTest[pdata]
tests whether the point collection pdata is distributed uniformly over the observation region.
SpatialRandomnessTest[pdata,"property"]
returns the value of "property".
SpatialRandomnessTest
SpatialRandomnessTest[pdata]
tests whether the point collection pdata is distributed uniformly over the observation region.
SpatialRandomnessTest[pdata,"property"]
returns the value of "property".
Details and Options
- SpatialRandomnessTest performs a goodness-of-fit hypothesis test with null hypothesis
that pdata was drawn from a PoissonPointProcess and alternative hypothesis
that it was not. -
- By default, a probability value or
-value is returned. - A small
-value suggests that it is unlikely that pdata comes from a PoissonPointProcess. - The point data pdata can have the following forms:
-
{p1,p2,…} points pi GeoPosition[…],GeoPositionXYZ[…],… geographic points SpatialPointData[…] spatial point collection {pts,reg} point collection pts and observation region reg - If the observation region reg is not given, a region is automatically computed using RipleyRassonRegion.
- SpatialRandomnessTest[pdata,"test"] will report the
-value according to "test". - SpatialRandomnessTest[pdata,All] will choose all tests.
- Under the null hypothesis
, the points in pdata were drawn from a PoissonPointProcess[λ]. This means they should be uniformly distributed over the given observation region reg. By binning the points, the standard bin count residual
, where
and
are the count and expected count in bin i, respectively, should be approximately chi-square distributed, and the count
should be multinomially distributed. - The following tests can be used:
-
"BesagL" based on BesagL, which is expected to be a straight line as a function of radius, slower and higher statistical power "ChiSquare" based on binning, where standard bin count residuals are expected to be chi-square distributed, fast and approximate "ModifiedChiSquare" based on binning, where counts are expected to be multinomially distributed, exact for small samples, using "ChiSquare" for large data - SpatialRandomnessTest[pdata,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
- SpatialRandomnessTest[pdata,"property"] can be used to directly give the value of "property".
- Properties related to the reporting of test results include:
-
"AllTests" list of all applicable tests "AutomaticTest" test chosen if Automatic is used "PValue" list of
-values"PValueTable" formatted table of
-values"ShortTestConclusion" a short description of the conclusion of a test "TestConclusion" a description of the conclusion of a test "TestData" list of pairs of test statistics and
-values"TestDataTable" formatted table of
-values and test statistics"TestStatistic" list of test statistics "TestStatisticTable" formatted table of test statistics - The following options can be used:
-
SignificanceLevel 0.05 cutoff for diagnostics and reporting
Examples
open all close allBasic Examples (2)
Uniform point distribution on a disk:
data = RandomPointConfiguration[PoissonPointProcess[20, 2], Disk[]];ListPlot[data]The data came from a point process with homogeneous intensity:
SpatialRandomnessTest[data]Points distributed over a geographical region:
reg = Entity["Country", "Spain"];pts = RandomPointConfiguration[PoissonPointProcess[Quantity[.005, 1 / "Kilometers" ^ 2], 2], reg]The data came from a point process with homogeneous intensity:
SpatialRandomnessTest[pts]Scope (10)
Testing (7)
spd1 = RandomPointConfiguration[PoissonPointProcess[1300, 2], Disk[]];
spd2 = RandomPointConfiguration[ThomasPointProcess[10, 30, .05, 2], Disk[]];ListPlot[#["Points"], AspectRatio -> 1]& /@ {spd1, spd2}The
-values are typically large when points are uniformly distributed:
SpatialRandomnessTest[spd1]The
-values are typically small when there is spatial heterogeneity:
SpatialRandomnessTest[spd2]Perform a particular test for spatial randomness:
data = RandomPointConfiguration[MaternPointProcess[10, 40, .05, 2], Disk[]]htd = SpatialRandomnessTest[data, "ChiSquare"]Extract a property for a specific test:
SpatialRandomnessTest[data, { "ShortTestConclusion", "ChiSquare"}]Using Automatic applies the "AutomaticTest" option:
data = RandomPointConfiguration[PoissonPointProcess[130, 2], Disk[]];SpatialRandomnessTest[data, Automatic]The property "AutomaticTest" can be used to determine which test was chosen:
SpatialRandomnessTest[data, "AutomaticTest"]Perform all tests appropriate to the data simultaneously:
data = RandomPointConfiguration[PoissonPointProcess[10, 2], Disk[]];SpatialRandomnessTest[data, All]Use the property "AllTests" to identify which tests were used:
SpatialRandomnessTest[data, "AllTests"]Create a HypothesisTestData object for repeated property extraction:
data = RandomPointConfiguration[PoissonPointProcess[130, 2], Disk[]];ℋ = SpatialRandomnessTest[data, "HypothesisTestData"];The properties available for extraction:
ℋ["Properties"]Extract some properties from the HypothesisTestData object:
data = RandomPointConfiguration[PoissonPointProcess[130, 2], Disk[]];ℋ = SpatialRandomnessTest[data, "HypothesisTestData"];ℋ["AllTests"]The
-value and test statistic from the "ChiSquare" test:
ℋ["PValue", "ChiSquare"]ℋ["TestStatistic", "ChiSquare"]Extract any number of properties simultaneously:
data = RandomPointConfiguration[PoissonPointProcess[130, 2], Disk[]];ℋ = SpatialRandomnessTest[data, "HypothesisTestData"];The
-value and test statistic from a "ChiSquare" test:
ℋ[{"PValue", "ChiSquare"}, {"TestStatistic", "ChiSquare"}]Reporting (3)
Tabulate the results from a selection of tests:
data = RandomPointConfiguration[PoissonPointProcess[10, 2], Disk[]];ℋ = SpatialRandomnessTest[data, "HypothesisTestData"];A full table of all appropriate test results:
ℋ["TestDataTable", All]ℋ["PValueTable", All]A table of selected test results:
ℋ["TestDataTable", "ChiSquare"]Retrieve the entries from a test table for customized reporting:
data = RandomPointConfiguration[PoissonPointProcess[10, 2], Disk[]];ℋ = SpatialRandomnessTest[data, "HypothesisTestData"];res = ℋ["TestData", All];tests = ℋ["AllTests"]The
-values are above 0.05, so there is not enough evidence to reject
at that level:
Show[BarChart[res[[All, 2]], ChartLabels -> Placed[tests, Center], BarOrigin -> Left], Graphics[Line[{{.05, 0}, {.05, Length[tests] + 1}}]]]The significance level is used for "TestConclusion" and "ShortTestConclusion":
SeedRandom[1];
data = RandomPointConfiguration[ThomasPointProcess[3, 20, .05, 2], Disk[]]ℋ = SpatialRandomnessTest[data, "HypothesisTestData"];ℋ["TestConclusion", "BesagL"]Options (1)
SignificanceLevel (1)
Specify the significance level:
SeedRandom["J23"];
proc = ThomasPointProcess[20, 13, .23, 2];
data = RandomPointConfiguration[proc, Disk[]];ℋ1 = SpatialRandomnessTest[data, "HypothesisTestData", SignificanceLevel -> .01];ℋ2 = SpatialRandomnessTest[data, "HypothesisTestData", SignificanceLevel -> .005];The test conclusions may differ:
{ℋ1["ShortTestConclusion", "ChiSquare"], ℋ2["ShortTestConclusion", "ChiSquare"]}ℋ1["TestConclusion", "ChiSquare"]ℋ2["TestConclusion", "ChiSquare"]Neat Examples (1)
Distribution of the "ModifiedChiSquare" test statistic under a null hypothesis:
proc = PoissonPointProcess[10, 2];
sample = Table[data = RandomPointConfiguration[proc, Disk[]];SpatialRandomnessTest[data, "ModifiedChiSquare"], {500}];SmoothHistogram[sample, Automatic, PDF]Related Guides
History
Text
Wolfram Research (2020), SpatialRandomnessTest, Wolfram Language function, https://reference.wolfram.com/language/ref/SpatialRandomnessTest.html.
CMS
Wolfram Language. 2020. "SpatialRandomnessTest." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SpatialRandomnessTest.html.
APA
Wolfram Language. (2020). SpatialRandomnessTest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SpatialRandomnessTest.html
BibTeX
@misc{reference.wolfram_2026_spatialrandomnesstest, author="Wolfram Research", title="{SpatialRandomnessTest}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/SpatialRandomnessTest.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_spatialrandomnesstest, organization={Wolfram Research}, title={SpatialRandomnessTest}, year={2020}, url={https://reference.wolfram.com/language/ref/SpatialRandomnessTest.html}, note=[Accessed: 12-June-2026]}