azp_greedy: A greedy algorithm to solve the AZP problem

Description Usage Arguments Value Examples

View source: R/clustering.R

Description

The automatic zoning procedure (AZP) was initially outlined in Openshaw (1977) as a way to address some of the consequences of the modifiable areal unit problem (MAUP). In essence, it consists of a heuristic to find the best set of combinations of contiguous spatial units into p regions, minimizing the within sum of squares as a criterion of homogeneity. The number of regions needs to be specified beforehand, as in most other clustering methods considered so far.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
azp_greedy(
  p,
  w,
  data,
  bound_vals = vector("numeric"),
  min_bound = 0,
  inits = 0,
  initial_regions = vector("numeric"),
  distance_method = "euclidean",
  random_seed = 123456789
)

Arguments

p

The number of spatially constrained clusters

w

An instance of Weight class

data

A list of numeric vectors of selected variable

bound_vals

(optional) A numeric vector of selected bounding variable

min_bound

(optional) A minimum value that the sum value of bounding variable int each cluster should be greater than

inits

(optional) The number of construction re-runs, which is for ARiSeL "automatic regionalization with initial seed location"

initial_regions

(optional) The initial regions that the local search starts with. Default is empty. means the local search starts with a random process to "grow" clusters

distance_method

(optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan"

random_seed

(optional) The seed for random number generator. Defaults to 123456789.

Value

A list of numeric vectors represents a group of clusters

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda")
guerry <- geoda_open(guerry_path)
queen_w <- queen_weights(guerry)
guerry_df <- as.data.frame(guerry) # use as data.frame
data <- guerry_df[c('Crm_prs','Crm_prp','Litercy','Donatns','Infants','Suicids')]
azp_clusters <- azp_greedy(5, queen_w, data)
azp_clusters

## End(Not run)

lixun910/rgeoda documentation built on March 19, 2021, 3:49 p.m.