Introduction
Crime problems in the city of Chicago have gotten much exposure in media circles. Many online resources such as local newspapers (The Chicago Tribune), government agencies (Chicago Police), and academic institutions (University of Chicago Crime Lab) have attempted to use data stories and visualizations of the problems. We do not know, however of any attempts to use Wolfram Mathematicas powerful tools to visualize crime in Chicago.
Abstract
Crime rates remain an important issue in the national dialogue, and many communities are looking for new approaches to understand the problem and best use their resources to address crime. Therefore, there is much opportunity to use advances in big data technology to give policy makers and citizens more insight into crime patterns so that they can focus resources on the areas with the highest pockets of crime. The city of Chicago is at the forefront of the national consciousness regarding crime. In my project, a user will input a date and receive an output of all the crimes that occurred on that date in Chicago in chronological order. Markers will appear on the map when a crime occurs in a time lapse with different colors according to zip code.
Data Collection
I started my project by obtaining very accurate crime data from the city of Chicago, showing types of crimes, when they were reported, and where they happened.
I then inputted this information into Mathematica. I then split the crimes in to Property Crime, Crime on a Person, and Violations and used the TogglerBar function in order to select a number of crimes you want to put in.
{propertycrime, {"ARSON", "BURGLARY", "THEFT", "ROBBERY", "MOTOR VEHICLE THEFT", "CRIMINAL DAMAGE", "CRIMINAL TRESPASS", "HOMICIDE"}, ControlType -> TogglerBar, ControlPlacement -> Top},
{personcrime, {"ASSAULT", "BATTERY", "HUMAN TRAFFICKING", "CRIM SEXUAL\ ASSAULT", "DECEPTIVE PRACTICE", "SEX OFFENSE", "STALKING", "PROSTITUTION", "KIDNAPPING", "INTIMIDATION", "OFFENSE INVOLVING CHILDREN"}, ControlType -> TogglerBar,
ControlPlacement -> Top},
{violations, {"WEAPONS VIOLATION", "OTHER NARCOTIC \ VIOLATION", "LIQUOR LAW VIOLATION"}, ControlType -> TogglerBar,
ControlPlacement -> Top},
Manipulate
Manipulate[
Module[{crimetype},
crimetype = Join[propertycrime, personcrime, violations];
Quiet@GeoGraphics[
GeoMarker[
Select[data,
MemberQ[crimetype, #[[-1]]] && (#[[1]] == {year, month, day,
hour}) &][[All, {2, 3}]], "Color" -> Blue],
GeoCenter ->
Entity["City", {"Chicago", "Illinois", "UnitedStates"}],
GeoRange -> Quantity[20, "Miles"],
PlotLabel -> DateString[DateObject[{year, month, day, hour}]
]
]
],
Delimiter,
{propertycrime, {"ARSON", "BURGLARY", "THEFT", "ROBBERY",
"MOTOR VEHICLE THEFT", "CRIMINAL DAMAGE", "CRIMINAL TRESPASS",
"HOMICIDE"}, ControlType -> TogglerBar, ControlPlacement -> Top},
{personcrime, {"ASSAULT", "BATTERY", "HUMAN TRAFFICKING",
"CRIM SEXUAL\ ASSAULT", "DECEPTIVE PRACTICE", "SEX OFFENSE",
"STALKING", "PROSTITUTION", "KIDNAPPING", "INTIMIDATION",
"OFFENSE INVOLVING CHILDREN"}, ControlType -> TogglerBar,
ControlPlacement -> Top},
{violations, {"WEAPONS VIOLATION", "OTHER NARCOTIC \ VIOLATION",
"LIQUOR LAW VIOLATION"}, ControlType -> TogglerBar,
ControlPlacement -> Top},
Delimiter,
{{month, 6}, If[year == 2016, 6, 1], If[year == 2018, 6, 12], 1,
Appearance -> "Labeled", ControlPlacement -> Left},
{{day, If[year == 2016 && month == 6, 29,
If[year == 2017, 5, If[year == 2018 && month == 6, 5]]]},
If[month == 6 && year == 2016, 29, 1],
If [month == 1 || month == 3 || month == 5 || month == 7 ||
month == 8 || month == 10 || month == 12, 31,
If[month == 9 || month == 4 || month == 6 || month == 11,
If[month == 6 && year == 2018, 26, 30], 28]], 1,
Appearance -> "Labeled", ControlPlacement -> Left},
{{year, 2016}, 2016, 2018, 1, Appearance -> "Labeled",
ControlPlacement -> Left},
{{hour, 1}, 1, 23, 1, Appearance -> "Labeled",
ControlType -> Trigger, AnimationRate -> .5,
ControlPlacement -> Left},
Button["Include all crimes?", (propertycrime = {"ARSON", "BURGLARY",
"THEFT", "ROBBERY", "MOTOR VEHICLE THEFT", "CRIMINAL DAMAGE",
"CRIMINAL TRESPASS", "HOMICIDE"};
personcrime = {"ASSAULT", "BATTERY", "HUMAN TRAFFICKING",
"CRIM SEXUAL\ ASSAULT", "DECEPTIVE PRACTICE", "SEX OFFENSE",
"STALKING", "PROSTITUTION", "KIDNAPPING", "INTIMIDATION",
"OFFENSE INVOLVING CHILDREN"};
violations = {"WEAPONS VIOLATION", "OTHER NARCOTIC \ VIOLATION",
"LIQUOR LAW VIOLATION"};)],
Button["Remove all crimes?", (propertycrime = {}; personcrime = {};
violations = {};)],
ControlPlacement -> Left]
Results
The results show selected crimes and times when the crimes were reported correlated with the Chicago location where the crime occurred. The map can show the seasonality and geographic pattern of certain crimes in certain neighborhoods and test assumptions regarding how crime occurs in the city. For example, we can test the assumption that crimes like assault primarily happen during the summer because in the cold Chicago winter many people do not go outside and meet other people. The map also can be used to test assumptions about safety in certain parts of the city versus others, and if there are any seasonal or time variations that correlate.
Future Work
In the future I would like to expand out my project to vary colors on the map like a heat map, where I could set a time period and have areas of the city where crimes happen the most be dark red, but in areas where there are few crimes to be a cooler color. I would also like to build in probability to enable the user to choose a part of the city and perhaps a season or time and see the probability of crime happening in the location. If demographic data regarding criminals and victims is available, I would like to add functionality where a user could chose a certain demographic profile and see when and where it is most likely where they would commit a crime or be a victim of crime. Police could use data like this to know where to deploy patrol units and social services providers could use it to learn where and when they should focus their resources to prevent crime. I would also like to expand the data set to other cities. However, there is a challenge that not all police agencies collect or format their data in the same way. Looking at crime in border areas (ex: the Illinois/Indiana border at the very south end of Chicago) would be quite interesting, but the data challenges would be difficult.