Wolfram Research

Sample Data: Toronto Murders

Source Notebook

Locations of murders in Toronto annotated with marks including victim age, victim sex, type, murder method, and year

Details

Locations of murders in Toronto in the observation region that is the polygon shape of Toronto, annotated with marks including victim age, victim sex, type, murder method, and year.

Examples

Basic Examples (2) 

Retrieve the data:

In[1]:=
ResourceData[\!\(\*
TagBox["\"\<Sample Data: Toronto Murders\>\"",
#& ,
BoxID -> "ResourceTag-Sample Data: Toronto Murders-Input",
AutoDelete->True]\), "Data"]
Out[1]=

Summary of the spatial point data:

In[2]:=
ResourceData[\!\(\*
TagBox["\"\<Sample Data: Toronto Murders\>\"",
#& ,
BoxID -> "ResourceTag-Sample Data: Toronto Murders-Input",
AutoDelete->True]\), "Data"]["Summary"]
Out[2]=

Visualizations (3) 

Plot the spatial point data:

In[3]:=
ListPlot[ResourceData[\!\(\*
TagBox["\"\<Sample Data: Toronto Murders\>\"",
#& ,
BoxID -> "ResourceTag-Sample Data: Toronto Murders-Input",
AutoDelete->True]\), "Data"]]
Out[3]=

Visualize the smooth point density:

In[4]:=
density = SmoothPointDensity[ResourceData[\!\(\*
TagBox["\"\<Sample Data: Toronto Murders\>\"",
#& ,
BoxID -> "ResourceTag-Sample Data: Toronto Murders-Input",
AutoDelete->True]\), "Data"]]
Out[4]=
In[5]:=
Show[ContourPlot[density[{x, y}], {x, y} \[Element] ResourceData[\!\(\*
TagBox["\"\<Sample Data: Toronto Murders\>\"",
#& ,
BoxID -> "ResourceTag-Sample Data: Toronto Murders-Input",
AutoDelete->True]\), "ObservationRegion"], ColorFunction -> "Rainbow"], ListPlot[ResourceData[\!\(\*
TagBox["\"\<Sample Data: Toronto Murders\>\"",
#& ,
BoxID -> "ResourceTag-Sample Data: Toronto Murders-Input",
AutoDelete->True]\), "Data"], PlotStyle -> Black]]
Out[5]=

Visualize the data with annotations:

In[6]:=
Show[Graphics[{Opacity[.2], ResourceData[\!\(\*
TagBox["\"\<Sample Data: Toronto Murders\>\"",
#& ,
BoxID -> "ResourceTag-Sample Data: Toronto Murders-Input",
AutoDelete->True]\), "ObservationRegion"]}], PointValuePlot[ResourceData[\!\(\*
TagBox["\"\<Sample Data: Toronto Murders\>\"",
#& ,
BoxID -> "ResourceTag-Sample Data: Toronto Murders-Input",
AutoDelete->True]\), "Data"], {1 -> None, 2 -> Automatic, 3 -> None, 4 -> None, 5 -> None}, PlotLegends -> Automatic], PlotLabel -> "Victim sex"]
Out[6]=

Analysis (2) 

Compute probability of finding a point within given radius of an existing point - NearestNeighborG is the CDF of the nearest neighbor distribution:

In[7]:=
nnG = NearestNeighborG[ResourceData[\!\(\*
TagBox["\"\<Sample Data: Toronto Murders\>\"",
#& ,
BoxID -> "ResourceTag-Sample Data: Toronto Murders-Input",
AutoDelete->True]\), "Data"]]
Out[7]=
In[8]:=
maxR = nnG["MaxRadius"]
Out[8]=
In[9]:=
DiscretePlot[nnG[r], {r, maxR/100, maxR, maxR/100}, AxesLabel -> {"radius", "probability"}]
Out[9]=

Mean distance between a typical point and its nearest neighbor (for positive support distribution can be approximated via a Riemann sum of 1-CDF):

In[10]:=
step = maxR/100;
partition = Table[{k, k + step}, {k, 0, maxR, step}];
values = nnG[Mean /@ partition];
In[11]:=
Total[(1 - values)*step]
Out[11]=
In[12]:=
SpatialRandomnessTest[ResourceData[\!\(\*
TagBox["\"\<Sample Data: Toronto Murders\>\"",
#& ,
BoxID -> "ResourceTag-Sample Data: Toronto Murders-Input",
AutoDelete->True]\), "Data"], {"PValue", "TestConclusion"}] // Column
Out[12]=

Gosia Konwerska, "Sample Data: Toronto Murders" from the Wolfram Data Repository (2021) 

Data Resource History

Source Metadata

Publisher Information