Homepage: https://kwstat.github.io/hopkins
Repository: https://github.com/kwstat/hopkins
The hopkins()
function:
method="simple"
.method="torus"
to correct for edge effects in higher dimensions.We believe that most software implementations of Hopkins statistics are incorrect because they use "d=1" as the exponent of the distances in the calculation instead of "d=2" for 2-dimensional data or the more general "d=D" for D-dimensional data.
For full details, see Wright (2023), "Will the Real Hopkins Statistic Please Stand Up", https://journal.r-project.org/articles/RJ-2022-055/
# Install the released version from CRAN:
install.packages("hopkins")
# Install the development version from GitHub:
install.packages("devtools")
devtools::install_github("kwstat/hopkins")
library(hopkins)
hopkins(iris[, -5], m=15) # .9952293
hopkins.pval(0.21, 10) # .00466205
It is easy to mis-use Hopkins statistic. Here are some things you MUST think about. See the vignettes for more details.
The Hopkins statistic attempts to assess the spatial distribution of points. Prairie dogs cluster together in burrows, while the burrows are spaced somewhat evenly apart from each other. Also, prairie dogs (sort of) "hop", and "kins" is both "endearing" and "a group with similar characteristics". So "hopkins" could mean "a cute group of hoppers" (prairie dogs).