Edgar L.
The following graph shows the temperature and the 7 major felony crimes that occured in 2015 in New York City. The x-axis represents the date for both graphs. The y-axis does not have a specific unit so that both the felony assaults committed and temperaature could be displayed and visualized together. The reason this was done was so that both plots could compared in terms of shape, moments of increases, and moments of decreases. However, as the plots depict there seems to be no apparent correlation between the two elements. Felony incidents occur all year round.The number of felony incidents decrease and increase constantly and in a linear fashion. The temperature also increases and decreases constantly, however, there is an increase in temperature rounding the plot up during the season of summer.
VISUALIZATION
Individual Boroughs
Correlation: 0.0625819186365
Correlation: 0.034651362511
Correlation: -0.00106132311394
Correlation: 0.068681573923
Correlation: -0.00516481173215
The following graphs are formatted the same way as the graph above. These, however, show individual boroughs. Along with the legend to show which plot is which there is also a decimal number preceded by the word "Correlation: ". This number was computed using modified code from Joel Grus (https://github.com/joelgrus) to evaluate the correlation for every borough between the felony incidents there, in 2015, and the temperature. Neither, along with the overall NYC analysis showed nor produced a strong connection or correlation to the temperature, according to this project.
ANALYSIS
The correlation computed between the weather and the 7 major felony incidents in the year 2015 in New York City is 0.0518969506925. This means that there is very little to no correlation between the two elements. Together with the visuals above, this project shows no correlation between felony incidents and temperature in the year 2015 and in New York City.
​
This, however, does not conclude the general question does weather affect crime. For this to be completely analyzed all types of crime need to analyzed, along with precipitation, snow depth, more years, and more, if not, all locations. With more information and more analysis a clearer picture can be created from this. At the same time these types of crimes (felony incidents) can be seen to not be affected or have some sort of correlation with the temperature of NYC for the year 2015.
Citations
-
Grus, Joel. "Data Science from Scratch: First Principles with Python." O'Reilly Media, 30 April 2015. Programs created by Joel Grus were used and modified to derive the correlation. Grus code was attained from https://github.com/joelgrus/data-science-from-scratch.
-
Interactive data visualizations created using Bokeh. http://bokeh.pydata.org/en/latest/index.html
Code
Datasets
-
Weather data was scraped together from https://www.wunderground.com/
-
Crime data was attained from the open data source NYC Open Data. The data set used was that of New York City, occured in 2015, and focused on felony assaults. https://data.cityofnewyork.us/Public-Safety/NYPD-7-Major-Felony-Incidents/hyij-8hr7
DATA SCIENCE TOPIC
DATASETS
WEATHER
FELONY ASSAULTS
Due to a time constraint, at this moment, not every crime can be reviewed yet. The crime chosen for this project focused on 7 major felony incidents, which include Murder, Felony Assaults, and Rape. The crimes included in the dataset come from all 5 boroughs which make up New York City. This dataset was attained by NYC Open Data site.
For this project a weather dataset was retrieved, from wunderground.com. This information included the 2015 temperatures, precipitation, and snow depth in NYC. Before it could be used in this project the data had to scraped from the site. For this project the temperature was the main focus of the weather.