Code Monkey home page Code Monkey logo

dcshotspot's Introduction

DCshotspot

Some quick results from a little noodling about with the DC ShotSpotter data. Commands used to perform said noodling are found in DCCalendar.R.

A rather fruitful and interesting discussion of the data can be found on reddit.

Data preparation

39065 events were recorded by the ShotSpotter system from Jan. 27, 2006 to Jun. 24, 2013. The data was already nicely prepared in an Excel spreadsheet with columns for the DC Ward, timestamp, incident type (single or multiple gunshots), and coordinate information (accurate to 100 m) for each event. Data was loaded into R.

Cuts were made for days that may be contributing potentially spurious data attributable to false positives (fireworks and celebratory gunfire on Dec. 31 - Jan. 1 and Jul. 3 - Jul. 5 ).

The remaining 27930 events should represent, fairly accurately, gunshots detected in the wards that were monitored by the ShotSpotter. Due to the targeted ShotSpotter coverage, I settled in on exploring variables that are, essentially, independent of location: incidents as a function of month and time of day.

The data was sorted into twelve data frames corresponding to the month that each event took place in. Histograms binned by time of day (quarter-hour bins) were prepared for each of the months.

Data presentation

The data was arranged in a calendar-style form using Andy Teucher's modified version of multiplot.R.

Conclusions

The month to month comparisons are slightly biased due to the start and end points of the data set (~2/06 to ~7/13), but I do not believe the effect to impact the qualitative conclusion much. It is quite clear that June and July are particularly active months. This matches well with anecdotal accounts in popular media.

Also quickly apparent is the repeatable shape of the histograms. It seems very likely that this is attributable to the fact that it is a particularly poor idea to open fire in broad daylight. I have shaded the bars corresponding to the average daylight period for each month (as gathered from any number of daylight calculator websites), which does seem to account for the monthly variation (i.e. shifting and widening/shrinking) in the period of time in which gunshots are most frequent.

For grins, I went through the same analysis for Oakland, CA, and the same general patterns emerge:

Future work

I'm curious to know if the "broad daylight" hypothesis could be extended to well-lit areas. The location of street lights is publicly available but I will need to think a bit about the best way to set up this problem. This would be another problem that should be largely immune to the limited ShotSpotter coverage.

This is just spitballing at this point, but if there is a clear correlation between shot locations and absence of street lights, it would be fairly straightforward to implement a machine learning algorithm to find optimal places to introduce additional lights.

dcshotspot's People

Contributors

andrewyue avatar

Stargazers

Christian Stade-Schuldt avatar Randy avatar

Watchers

James Cloos avatar Randy avatar

Forkers

kevinaquino

dcshotspot's Issues

Thanks from Oakland

Hey Andrew, love seeing the Oakland data getting used!
I saw your thoughts about street lights- we've looked into that a bunch here- two things need solving- first the shotspotter data are rough to begin with- they scrub them to ~100m (or 100 feet, they didn't confirm w us!) accuracy before publishing, so the individual incident could technically be anywhere on a streetface- near a streetlight or in a dark patch.
Second, we did some field surveys to map light location and areas of unlit streets and found that the GPS on phones wasn't really accurate enough to map the light/unlit areas- making it hard to really see where streetlights provided coverage- made it hard to see if regular (accurate) crime report data was connected to lighting or not.
Last issue in our data was that they did not eliminate any of the non-gunshot incidents, so the data include fireworks, backfires etc- they don't bother to clean the data files, that's only part of the software feature the cops get to play with in-house- and that seems like a broken process to me..

Love to chat about this stuff- lots of possibility despite lots of issues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.