geo_detect: Detect regions that form an unusual spatial aggregation of...

Description Usage Arguments Examples

View source: R/geo_detect.R

Description

This function identifies clusters in data organized and aggregated into regions. The Kulldorff cluster detection method is used, which creates groupings of regions by consecutively aggregating nearest-neighbour areas until a set proportion of the total population is reached. The number of cases or events in the aggregation, compared to the expected count (as calculated or user-specified) is used to calculate the likelihood based on either a binomial or Poisson model. The output is the group of neighbouring regions that form the most likely cluster and, any secondary clusters. Optionally a map of the clusters can be generated.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
geo_detect(
  data,
  counts,
  pop,
  expected_counts = NULL,
  method = "kulldorff_binomial",
  plot = TRUE,
  legend_title = "Clusters",
  plot_title = NA,
  transparency = NA,
  hover_id,
  interactive = TRUE
)

Arguments

data

Name of input data for analysis. REQUIRED.

counts

Name of the data column that contains the observed counts that will be tested for clustering. REQUIRED.

pop

Name of data column that contains population sizes to be used for each region. For a cluster analysis, all regions must have a population size > 0. REQUIRED

expected_counts

Name of the data column that contains the expected counts for each region. Only used when method = "kulldorff_poisson" is specified. If no data column is provided, the expected count for each region is calculated automatically as proportionate share of the total counts based on population size. OPTIONAL.

method

Statistical method to be used for cluster detection. Available methods are "kulldorff_binomial" (default) and "kulldorff_poisson". OPTIONAL.

plot

Should an output plot be created showing clustered regions? Default is TRUE. If FALSE, output returns a listing of the regions included in the most likely cluster and the top two secondary clusters. OPTIONAL.

legend_title

Title of plot legend. If no value is given, 'Cluster' is used as the default title. OPTIONAL.

plot_title

Main title of plot. If omitted, no title is shown. Only applies to static image maps. OPTIONAL.

transparency

value between 0 and 1 (default) that defines transparency of map colours, from transparent (0) to opaque (1). Intermediate values allow more or less visibility of underlying (reference) layers in interactive maps. OPTIONAL.

hover_id

Name of the data column containing the label or value to be shown when hovering over a particular geographic unit. For interactive maps only. Default is the value given in the specified 'counts' column. OPTIONAL.

interactive

TRUE (default) or FALSE. Indicating whether map should be generated as an interactive view or as a static image. OPTIONAL.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Cluster analysis and map of event rate based on Kulldorff binomial model ----------------
geo_detect(data = my_geo_data,
  counts = events_data_column,
  pop = pop_data_column,
  method = "kulldorff_binomial",
  plot = TRUE)

# Cluster analysis and map of event rate based on Kulldorff Poisson model -----------------
geo_detect(data = my_geo_data,
  counts = events_data_column,
  pop = pop_data_column,
  expected_counts = expected_data_column,
  method = "kulldorff_poisson",
  plot = TRUE)

# Cluster analysis and return listing of regions included in top three clusters -----------
geo_detect(data = my_geo_data,
  counts = events_data_column,
  pop = pop_data_column,
  method = "kulldorff_binomial",
  plot = FALSE)

cpacc/geode documentation built on Feb. 13, 2022, 2:33 p.m.