gstar: Calculate Local Getis-Ord Gi* statistic

gstarR Documentation

Calculate Local Getis-Ord Gi* statistic

Description

Calculating the Local Getis-Ord Gi* for detecting significant hotspots from an nbmatrix object

Usage

gstar(
  object,
  alternative = "greater",
  nsim = 999,
  verbose = FALSE
  )

Arguments

object

Object of class nbmatrix

alternative

a character string specifying the alternative hypothesis, must be one of "greater" (default), "less" or "two.sided"; passed to sfdep::local_gstar_perm

nsim

numeric value with number of simulations to run; passed to sfdep::local_gstar_perm

verbose

bool argument which indicates whether progress messages are displayed

Details

Unlike the global Getis-Ord statistic, the Getis-Ord G_i^* statistic (Getis & Ord 1992) is calculated for each region in the study. Based on the calculated z-scores and their p-values, the analysis identifies where regions with high or low values tend to form spatial clusters. A typical application is, for example, investigating whether high or low incidence of infectious diseases is spatially clustered, that is, identifying hotspots and/or coldspots. This function internally uses sfdep::local_gstar_perm.test for calculation (see the corresponding documentation). The results are written in the nbmatrix instance and displayed in the summary.

Value

object of class nbmatrix-class

Author(s)

Thomas Wieland

References

Cliff AD, Ord JK (1981) Spatial Processes: Models & Applications. https://archive.org/details/spatialprocesses0000clif

GeoDa Center (2026) GeoDa. An Introduction to Spatial Data Science. https://geodacenter.github.io/

Getis A, Ord JK (1992). The analysis of spatial association by use of distance statistics. Geographical Analysis 24 (3), 189–206. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.1111/j.1538-4632.1992.tb00261.x")}

Ord JK, Getis A (1995) Local Spatial Autocorrelation Statistics: Distributional Issues and an Application. Geographical Analysis 27, 286-306. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.1111/j.1538-4632.1995.tb00912.x")}

See Also

nbmatrix, getisord, nbstat, moran

Examples

data(RKI_Corona_counties)
# German counties (Source: Robert Koch Institute)

Corona_nbmat <- 
  nbmatrix (
    RKI_Corona_counties, 
    ID_col="AGS",
    verbose = TRUE
  )
# Creating neighborhood matrix

Corona_nbstat2 <- nbstat(
  Corona_nbmat,
  link_data = RKI_Corona_counties, 
  ID_col = "AGS", 
  data_col = "cases_per_", 
  func = NULL,
  verbose = TRUE
  )
# New nbmatrix instance
# Defining "cases_per_" (COVID-19 cases per 100,000 inhabitants) as analysis column

Corona_SpatialStatistics <- gstar(
  Corona_nbstat2,
  verbose = TRUE
  )
# Calculating Local Getis-Ord Gi*

summary(Corona_SpatialStatistics)
# Summary of nbmatrix object

swash documentation built on Oct. 18, 2026, 5:06 p.m.