Subscribe to DSC Newsletter

San Francisco Police Department Crime Incidents: Part 2-Geo Analysis

Introduction

The City and County of San Francisco had launched an official open data portal called SF OpenData in 2009 as a product of its official open data program, DataSF. The portal contains hundreds of city datasets for use by developers, analysts, residents and more. Under the category of Public Safety, the portal contains the list of SFPD Incidents since Jan 1, 2003.
In my previous post I performed an exploratory time-series analysis on the crime incidents data to identify any patterns.
In this post I have performed an exploratory geo analysis on the crime incidents data to identify any patterns based on the San Francisco Police Department District classification.

Data

The data for this analysis has been downloaded from the publicly available data from the City and County of San Francisco’s OpenData website SF OpenData. The crime incidents database has data recorded from the year 2003 till date. I downloaded the full data and performed my analysis for the time period from 2003 to 2015, filtering out the data from the year 2016. There are nearly 1.9 million crime incidents in this dataset.
I have performed minimal data processing on the downloaded raw data to facilitate my analysis.


SFPD Police Districts

There are 10 police districts in the City and County of San Francisco. I have categorized my analysis based on these Police Districts.
•    Bayview
•    Central
•    Ingleside
•    Mission
•    Northern
•    Park
•    Richmond
•    Southern
•    Taraval
•    Tenderloin

Analysis

Crimes in Police District over the Years

The following plot depicts the number of crimes recorded from the year 2003 till the end of the year 2015 and categorized by the SFPD Police Districts.

By analyzing the plot above, we can arrive at the following insights:

  • Southern district has the highest number of crimes over the years and the number of crimes has been increasing in the last few years. In addition, Central district also had sharp increase in the number of crimes in the last few years. Northern district despite seeing a steady decline in the number of crimes from the year 2003 till 2010, have had sharp increase in the number of crimes since 2011.
  • Park and Richmond districts have had the lowest number of crimes over these years.
  • Only Mission and Tenderloin has seen a steady decline in the number of crimes in recent years.


Crimes in Police District by Hour of the Day

The following plot depicts the number of crimes recorded by the hour and categorized by the SFPD Police Districts.

By analyzing the plot above, we can arrive at the following insights:

  • The number of crimes steadily decline from midnight and are at the lowest during the early morning hours and then they start increasing and peak around 6 PM in the evening. This is the same insight we arrived in my previous analysis but here we have categorized by the Police district and still see the same pattern.
  • As seen in the previous plot, Park and Richmond districts have the lowest number of crimes throughout the day.
  • As highlighted in red in the plot above, the maximum number of crimes happens in Southern district around 6 PM in the evening.


Crimes in Police District by Day of Week

The following plot depicts the number of crimes recorded during different days of the week and categorized by the SFPD Police Districts.

By analyzing the plot above, we can arrive at the following insights:

  • In general, there is less number of crimes happening during the weekends than weekdays across all districts. The only exception here is Central where more number of crimes happens during the weekend, particularly on Saturdays. One possible reason could be that there are more number of people around the Pier on Saturdays.
  • One more observation is that the crimes usually peak on Fridays across all districts with the exception of Tenderloin, where Wednesday seems to have most number of crimes.
  • As highlighted in red in the plot above, Fridays in Southern district seems to have the maximum number of crimes happening. Taking into consideration the analysis from the previous plot, it is possible that Fridays around 6 PM in Southern district seems to be the most dangerous time with regards to the number of crimes happening.

Technology

This analysis was performed entirely using RStudio version 0.99 and R Version 3.2.0.
The data processing and plots were done using the R libraries ggplot2 and dplyr.

Views: 914

Comment

You need to be a member of Data Science Central to add comments!

Join Data Science Central

Videos

  • Add Videos
  • View All

© 2019   Data Science Central ®   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service