This is a collection of datasets and source code used for a crime prediction study based on POI locations.
[1] Crime data from data.police.uk for the following UK police forces: -- Greater Manchester Police, -- Merseyside Police, -- Dorset Police, -- West Yorkshire Police. Time span: October 2016--September 2019. License: https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/ Format: CVS (zipped). Files: GreaterManchesterPolice.zip MerseysidePolice.zip Dorset Police.zip West Yorkshire Police.zip
[2] Data extracts from OpenStreetMap made available by Geofabrik.de for the following UK counties: -- Greater Manchester, -- Merseyside, -- Dorset, -- West Yorkshire. Data layers: pois, pois_a, transport, transport_a. Downloaded on: November 14, 2019. License: Open Database License 1.0. Format: shapefile (zipped). Files: greater-manchester-latest-free.shp.zip merseyside-latest-free.shp.zip dorset-latest-free.shp.zip west-yorkshire-latest-free.shp.zip
[4] Administrative boundary data for the following UK urban areas: -- Manchester (Manchester District), -- Liverpool (Liverpool District), -- Bournemouth (Bournemouth, Christchurch and Poole District), -- Wakefield (Wakefield District). Obtained by extracting the corresponding districts from dataset [3] listed above. Format: RDS. File: adm-man-liv-bou-wak.RDS.
[5] Crime data aggregated to 300x300m grid for the following UK urban areas: -- Manchester (Manchester District), -- Liverpool (Liverpool District), -- Bournemouth (Bournemouth, Christchurch and Poole District), -- Wakefield (Wakefield District). Obtained by geographical aggregation of crime data [1] listed above, limited to the corresponding district boundaries from [3]. Format: RDS. File: crime-grid-man-liv-bou-wak.RDS.
[6] POI data aggregated to 300x300m grid for the following UK urban areas: -- Manchester (Manchester District), -- Liverpool (Liverpool District), -- Wakefield (Wakefield District), -- Bournemouth (Bournemouth, Christchurch and Poole District). Obtained by geographical aggregation of POI data [2] listed above, limited to the corresponding district boundaries from [3]. Format: RDS. File: poi-grid-man-liv-bou-wak.RDS.
[7] R functions for data preparation.
File: crime-poi-functions-data.R.
[8] R functions for model creation and evaluation.
File: crime-poi-functions-model.R.
[9] R script for data preparation.
File: crime-poi-data.R.
[10] R script for model creation and evaluation.
File: crime-poi-model.R.
The code assumes that:
-- source code files are placed in the current working directory,
-- original unprocessed data files [1-3] are placed in the data subdirectory of the current working directory,
-- the RDS subdirectory exists in the current working directory (this is where RDS files are saved),
-- the Plots subdirectory exists in the current working directory (this is where plot files are saved).
The provided RDS files [4-6] may be optionally placed in the RDS subdirectory to avoid repeating the time-consuming data preparation process -- they will be used if available or re-created from the original data otherwise (but the latter may take several hours).