Skip to contents

Uses HOOD_158 (the 158-neighbourhood scheme) and reports a Gini coefficient plus the cumulative share of incidents in the top-10 and top-20 neighbourhoods.

Usage

morie_tps_neighbourhood_concentration(df, ds_name = "?")

Arguments

df

A TPS crime data.frame.

ds_name

Optional dataset label used in the result title.

Value

A morie_tps_result list with payload$gini, payload$n_hoods, payload$p_top10, payload$p_top20.

Examples

# \donttest{
df <- try(morie_datasets_tps_assault(max_features = 200L))
if (!inherits(df, "try-error")) {
  res <- try(morie_tps_neighbourhood_concentration(df, ds_name = "assault"))
  if (!inherits(res, "try-error")) str(res, max.level = 1)
}
#> List of 8
#>  $ title         : chr "TPS neighbourhood concentration -- assault"
#>  $ call          : NULL
#>  $ summary_lines :List of 4
#>  $ tables        :List of 1
#>  $ warnings      : chr(0) 
#>  $ interpretation: chr "Gini = 0.000 measures how unequally incidents are distributed across neighbourhoods. Higher = more concentrated"| __truncated__
#>  $ payload       :List of 5
#>  $ sections      : list()
#>  - attr(*, "class")= chr [1:3] "morie_tps_result" "morie_rich_result" "list"
# }