| spatial_statistic | R Documentation |
Calculation of a specified spatial statistic for the data from an infpan object.
spatial_statistic(
object,
attribute = "Cases",
timepoint = NULL,
statistic = "nbstat",
func = NULL,
row.names = NULL,
snap = NULL,
queen = TRUE,
weights_style = "W",
weights_zeropolicy = NULL,
verbose = FALSE,
...
)
object |
object of class |
attribute |
Attribute for which the statistic is calculated, must be defined in |
timepoint |
Time point for which the statistic is calculated |
statistic |
Statistic to be computed |
func |
If |
row.names |
row.names for the |
snap |
Snapping distance, passed to |
queen |
If TRUE, a single shared boundary point meets the contiguity condition; passed to |
weights_style |
weights_style can take values “W”, “B”, “C”, “U”, “minmax” and “S”; passed to the |
weights_zeropolicy |
if FALSE stop with error for any empty neighbour sets, if TRUE permit the weights list to be formed with zero-length weights vectors;
passed to the |
verbose |
|
... |
Further arguments passed to the spatial statistics functions (see details) |
The user must choose a specific time point using the timepoint argument.
If no time point is stated, the most current time point is chosen automatically.
The ... arguments are passed to the specific spatial statistics function
which depends on what is specified by argument statistic.
See moran, getisord, gstar.
nbmatrix object including the spatial statistic to be calculated
Thomas Wieland
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/
Wieland T (2020) Flatten the Curve! Modeling SARS-CoV-2/COVID-19 Growth in Germany at the County Level. REGION 7(2), 43–83. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.18335/region.v7i2.324")}
Wieland T (2022) Spatial patterns of excess mortality in the first year of the COVID-19 pandemic in Germany. European Journal of Geography 13(4), 18-33. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.48088/ejg.t.wie.13.4.018.033")}
infpan-class, nbstat, nbmatrix, moran, getisord, gstar
data(COVID19Cases_geoRegion)
# Get SWISS COVID19 cases at NUTS 3 level
data(K4kant20260101gf_ch2007Poly)
# Cantonal boundaries of Switzerland
COVID19Cases_geoRegion <-
COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),]
# Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total
COVID19Cases_geoRegion <-
COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",]
# Extract first COVID-19 wave
infpan_CH <- load_infections_paneldata(
data = COVID19Cases_geoRegion,
col_cases = "entries",
col_date = "datum",
col_region = "geoRegion",
other_cols = c(
"Population" = "pop"
),
verbose = TRUE
)
# Import as infections panel data set (class infpan)
infpan_CH <- add_geodata(
infpan_CH,
K4kant20260101gf_ch2007Poly,
unit_col = "cant_abbrev"
)
# Adding geodata (sf) to infpan object
summary(infpan_CH)
# Summary of infpan object
timestamps(infpan_CH)
# Time stamps of infpan object
moran_incidence <-
spatial_statistic(
infpan_CH,
statistic = "moran",
randomization = FALSE
)
# Calculating Moran's I test under normality
# Result = nbmatrix object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.