-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseattle_crime_2008-2014-reported.Rmd
165 lines (120 loc) · 8.44 KB
/
seattle_crime_2008-2014-reported.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
---
title: "Seattle Crime & I-502 in the Central and South Precincts, 2008-2014"
author: "Thomas P Kiehne"
date: "Friday, August 07, 2015"
output:
html_document:
keep_md: true
---
```{r setoptions, message = FALSE, tidy = FALSE, echo = FALSE, warning=FALSE}
options(width = 116, scipen = 5, digits = 2)
library(knitr)
opts_chunk$set(comment=NA, fig.width=9, fig.height=6)
library(dplyr, warn.conflicts=F, quietly=T)
library(lattice)
```
## Synopsis
Question: Has the implementation of I-502 (the marijuana legalization initiative of 2012) caused an upsurge of gang crime activity in the Central and South districts of Seattle? We look at the [crime data published by the City of Seattle](https://data.seattle.gov) focusing specifically on the East and South precincts of the city where gang activity is most prevalent. An analysis of reported crime does not appear to indicate an upsurge of crime activity after the implementation of I-502.
## Data Processing
Crime data are available from the City of Seattle in a well organized format that is divided by police sector and crime type. This specific data set is based on initial police reports taken by officers when responding to incidents around the city. It is worth noting that this analysis is based on data collected when police are dispatched to investigate a crime report, which implies that unreported crime is not represented. However, it is assumed that any increase in unreported crime would induce a similar signal in reported crime.
Data are read directly from the City of Seattle site for processing:
```{r data}
if(!file.exists("Seattle_Police_Department_Police_Report_Incident.csv") &
file.exists("Seattle_Police_Department_Police_Report_Incident.zip"))
{
unzip("Seattle_Police_Department_Police_Report_Incident.zip")
}
if(!file.exists("Seattle_Police_Department_Police_Report_Incident.csv"))
{
download.file("https://data.seattle.gov/api/views/7ais-f98f/rows.csv?accessType=DOWNLOAD", "Seattle_Police_Department_Police_Report_Incident.csv", method="internal", mode="w")
}
# read data
crime <- read.csv("Seattle_Police_Department_Police_Report_Incident.csv")
```
For this analysis we are interested in violent crimes specifically, but add narcotics, weapons, and other violent crimes as a proxy for the sorts of activities that might be reported in relation to gang activity. Data are read directly from the City of Seattle site and processed to filter out crimes and beats that are not relevant to our study.
Then we filter out reports from before 2008 and retain [police sectors](http://spdblotter.seattle.gov/2015/01/27/spd-adds-supervisors-shifts-police-beats-as-part-of-reform-efforts/) representing the Central District, Capitol Hill, and points south that comprise most of the East and South precincts:
```{r datafilter}
# convert dates to date objects
crime <- mutate(crime, Date.Reported = as.Date(Date.Reported, "%m/%e/%Y"))
# since 2008
crime <- filter(crime, Date.Reported >= "2008-01-01")
# South and East precincts only
crime <- filter(crime, District.Sector %in% c("E", "C", "G", "R", "S"))
```
Then we filter out all crimes that are not related to violent crimes, weapons, weapons discharge, and narcotics; marijuana related crimes are specifically excluded to avoid bias between the before and after I-502 period:
```{r datafilter2}
# specific crimes only
crimefilter <- c("ASSLT-AGG-BODYFORCE", "ASSLT-AGG-GUN", "ASSLT-AGG-WEAPON", "ASSLT-OTHER",
"DRIVE-BY", "HOMICIDE-JUST-GUN", "HOMICIDE-JUST-WEAPON",
"HOMICIDE-NEG-MANS-BODYFORCE", "HOMICIDE-NEG-MANS-GUN",
"HOMICIDE-PREMEDITATED-BODYFORC", "HOMICIDE-PREMEDITATED-GUN",
"NARC-DISTRIBUTE-HALLUCINOGEN", "NARC-DRUG TRAFFIC LOITERING",
"NARC-EQUIPMENT/PARAPHENALIA", "NARC-FORGERY-PRESCRIPTION",
"NARC-FOUND-AMPHETAMINE", "NARC-FOUND-COCAINE", "NARC-FOUND-HALLUCINOGEN",
"NARC-FOUND-HEROIN", "NARC-FOUND-METH", "NARC-FOUND-OPIUM",
"NARC-FOUND-PILL/TABLET", "NARC-FOUND-SYNTHETIC", "NARC-FRAUD-PRESCRIPTION",
"NARC-MANUFACTURE-HALLUCINOGEN", "NARC-MANUFACTURE-OTHER",
"NARC-POSSESS-AMPHETAMINE", "NARC-POSSESS-BARBITUATE", "NARC-POSSESS-COCAINE",
"NARC-POSSESS-HALLUCINOGEN", "NARC-POSSESS-HEROIN", "NARC-POSSESS-METH",
"NARC-POSSESS-OPIUM", "NARC-POSSESS-PILL/TABLET", "NARC-POSSESS-PRESCRIPTION",
"NARC-POSSESS-SYNTHETIC", "NARC-SELL-AMPHETAMINE", "NARC-SELL-BARBITUATE",
"NARC-SELL-COCAINE", "NARC-SELL-HALLUCINOGEN", "NARC-SELL-HEROIN",
"NARC-SELL-METH", "NARC-SELL-OPIUM", "NARC-SELL-PILL/TABLET",
"NARC-SELL-PRESCRIPTION", "NARC-SELL-SYNTHETIC", "NARC-SMUGGLE-COCAINE",
"NARC-SMUGGLE-METH", "NARC-SMUGGLE-OTHER", "ROBBERY-RESIDENCE-GUN",
"ROBBERY-RESIDENCE-WEAPON", "ROBBERY-STREET-BODYFORCE", "ROBBERY-STREET-GUN",
"ROBBERY-STREET-WEAPON", "THREATS-KILL", "THREATS-OTHER", "THREATS-WEAPON",
"WEAPON-CONCEALED", "WEAPON-DISCHARGE", "WEAPON-POSSESSION", "WEAPON-SELLING",
"WEAPON-SURRENDER-EXCLUDING FIR", "WEAPON-UNLAWFUL USE")
crime <- filter(crime, Offense.Type %in% crimefilter)
```
## Results
Using the prepared data, we can look visually at the reported crime trends in the East and South precincts from 2008-2014. A linear trend line is shown in red and the date of the first I-502 shop opening in Seattle (July 8, 2014) is indicated by the vertical black line.
```{r allperiods}
rate0815 <- aggregate(RMS.CDW.ID ~ Date.Reported, data=crime, FUN=length)
xyplot(RMS.CDW.ID ~ Date.Reported, data=rate0815,
panel=function(x, y, col, ...) {
panel.xyplot(x, y, col="blue", ...)
panel.lmline(x, y, col="red")
panel.abline(v=as.Date("2014-07-08"), col="black", lwd=3)
},
type="l",
xlab="Year",
ylab="Number of Crimes",
main="Seattle Violent Crimes in East and South Precincts"
)
```
We see an overall upward trend over the more than 7 year period. This signal is diffiult to interpret given the changes in population and other social factors that occurred over this time. To gain clarity we need to examine the trends in more recent time periods.
I-502 was approved by voters in November of 2012, but implementation did not occur for more than a year as WSLCB finalized rules and procedures. The first recreational pot store in Seattle opened in July of 2014 meaning that prior to that month no legal marijuana was availabe to the public. Therefore, if any significant crime impact due to the introduction of legal pot were to occur it would be after that date.
We can assess this hypothesis by looking visually at the crime trends for the subject areas from 2012 through 2015 to date.
```{r recentperiods}
rate1214 <- filter(rate0815, Date.Reported >= "2012-01-01")
xyplot(RMS.CDW.ID ~ Date.Reported, data=rate1214,
panel=function(x, y, col, ...) {
panel.xyplot(x, y, col="blue", ...)
panel.lmline(x, y, col="red")
panel.abline(v=as.Date("2014-07-08"), col="black", lwd=3)
},
type="l",
xlab="Year",
ylab="Number of Crimes",
main="Seattle Violent Crimes in East and South Precincts"
)
```
We can clearly see a slight downward trend over more than three years covering the time immediately before and after the availability of legal pot in Seattle. This suggests that the signal increase we saw in the 2008 and later plot was spent by or soon after 2012.
To take it one step further, we can look at the trend since the opening of marijuana sales in Seattle on July 2014:
```{r postperiod}
ratepost <- filter(rate0815, Date.Reported >= "2014-07-01")
xyplot(RMS.CDW.ID ~ Date.Reported, data=ratepost,
panel=function(x, y, col, ...) {
panel.xyplot(x, y, col="blue", ...)
panel.lmline(x, y, col="red")
panel.abline(v=as.Date("2014-07-08"), col="black", lwd=3)
},
type="l",
xlab="Year",
ylab="Number of Crimes",
main="Seattle Violent Crimes Since I-502 in East and South Precincts"
)
```
Here we see a significant decline in violent and drug crimes since the implementation of I-502. The analysis is not consistent with the premise that crime has increased with the passage and implementation of I-502.