-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrmain.html
128 lines (91 loc) · 5.67 KB
/
crmain.html
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
<div w3-include-html="header.html"></div>
<script src="https://www.w3schools.com/lib/w3.js"></script>
<script>
w3.includeHTML();
</script>
<script>
function bottomNav(arr) {
var out =
`<div class="container">
<div class="col-lg-2 text-left">
<a href="${arr[0][0]}">
<button type="button" class="btn btn-default btn-xs btn-basic">
${arr[0][1]}<span class="glyphicon glyphicon-home" aria-hidden="true"></span>
</button>
</a>
</div>
<div class="col-lg-8 text-center">
<a href="${arr[1][0]}">
<button type="button" class="btn btn-default btn-xs btn-basic">
${arr[1][1]}<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
</button>
</a>
</div>
<div class="col-lg-2 text-right">
<a href="${arr[2][0]}">
<button type="button" class="btn btn-default btn-xs btn-basic">
${arr[2][1]}<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
</button>
</a>
</div>
</div>`;
return out;
}
</script>
<div w3-include-html="footer.html"></div>
<script>
var out = bottomNav([['', ''], ['', ''], ['stateBar.html', 'State Crime Overview']]);
// [['crmain.html','Overview'], ['stateBar.html','State Crime Overview'],['stateCrime.html','State Crime Details'],['countyCrime.html','County Crime Overview'],['countyBar.html','County Crime Exploration']]
document.write(out);
</script>
<xmp theme="united" style="display:none;">
### 1.0 Overview: Crime Rate vs Population by County in the United States (2012)
#### Problem Statement and Question Asked
The FBI compiles annual county level crime statistics bucketed into 45 categories
This workbook explores the relationship between Total Violent Crimes - defined as the sum of Murder, Rape, Robbery, and Aggravated Assault - and the County Population. The intuition we seek is: "Does a higher population density lead to a higher per-capita crime rate? And also "Which population centers have achieved a relatively lower per-capita crime rate?
#### Approach
We direct the exploration through a sequence State -> County -> Free Form investigation i.e. a Martini approach.
| State Level | We approach the visualization by A second trio of visualizations breaks out the comparisons on a Rural vs Average vs Urban areas |
|-- |---|
| |We then have a perspective that tends towards *Regional* distinctions in crime rate. |
| County Level | Same approach as for State Level: A second set of six charts breaks out the comparisons on a Rural vs Average vs Urban areas |
| U.S. Level | We then zoom out and allow user to *explore for themselves* at a national level. |
#### Data Preparation:
The FBI data may be accessed (after agreeing to various terms of use) at https://www.ojjdp.gov/ojstatbb/ezaucr/asp/methods.asp and http://www.icpsr.umich.edu/cgi-bin/terms . The data itself is incomplete: not all counties - or even all states - have provided data to support the FBI's report. When the Total Crimes reported for a county are Zero then the data is excluded from analysis and the County is grayed out.
The state land area was obtained from : https://www.census.gov/geo/reference/state-area.html
The county land area was obtained from: http://www2.census.gov/prod2/statcomp/usac/excel/LND01.xls
The US State Regions was taken from US Census Bureau https://en.wikipedia.org/wiki/List_of_regions_of_the_United_States#Census_Bureau-designated_regions_and_divisions
The data was processed by using pandasql to achieve:
- selecting only the necessary columns
- normalizing the crime figures for the population value
- creating buckets for the county population size and the crime rate
- joining the state area data
- joining the county area data
- joining the US Census designated Regions (by state)
- generating the following enrichment features:
- County population density
- County Crime Rate
- County Crime Rate by population (total crime / population)
- County Crime Rate by area (total crime / area)
- State Area (from sum of counties)
- State population density
- State Crime Rate by population (total crime / population)
- State Crime Rate by area (total crime / area)
#### Chart Preparation
The Crime Data was matched with existing US County Map by the FIS State/County codes.
- A "martini" approach was taken to the exploration
- State level overview and details
- Combined STate/County info
- County Level overview
- County Level "Exploration" via selecting a State
- Transitions are provided via two types of menu navigation: a dashboard style pushbutton and page-specific previous/next type buttons
- Color gradients are used on some graphs for showing crime rate using intense red hues for high rates
- Scatterplots are used for quantitative vs quantitative plots
- Bar charts are used for quantitative vs nominal plots
#### Results and Analysis
Having prior knowledge of the general trends I was expecting to see a higher crime rate in the SouthEast and lower in the Upper Midwest, Plains States, and upper NorthEast. In addition New York City is well known for its sterling crime record whereas Chicago, Saint Louis, and New Orleans have the opposite reputation. The results do corroborate those "apriori" known facts.
#### Some additional observations:
Overall the rural areas do fare better than urban ones. But the "Average" areas tend to have the best of the three categories
</xmp>
<script src="strapdown.js"></script>
<script>setTimeout(function(){document.getElementById('overviewTab').className = 'active';},100);</script>