forked from vincentarelbundock/Rdatasets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guns.html
126 lines (92 loc) · 3.85 KB
/
Guns.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
<!DOCTYPE html><html><head><title>R: More Guns, Less Crime?</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css">
<script type="text/javascript">
const macros = { "\\R": "\\textsf{R}", "\\code": "\\texttt"};
function processMathHTML() {
var l = document.getElementsByClassName('reqn');
for (let e of l) { katex.render(e.textContent, e, { throwOnError: false, macros }); }
return;
}</script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"
onload="processMathHTML();"></script>
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body><div class="container">
<table style="width: 100%;"><tr><td>Guns</td><td style="text-align: right;">R Documentation</td></tr></table>
<h2>More Guns, Less Crime?</h2>
<h3>Description</h3>
<p>Guns is a balanced panel of data on 50 US states, plus the District of Columbia (for a
total of 51 states), by year for 1977–1999.
</p>
<h3>Usage</h3>
<pre><code class='language-R'>data("Guns")</code></pre>
<h3>Format</h3>
<p>A data frame containing 1,173 observations on 13 variables.
</p>
<dl>
<dt>state</dt><dd><p>factor indicating state.</p>
</dd>
<dt>year</dt><dd><p>factor indicating year.</p>
</dd>
<dt>violent</dt><dd><p>violent crime rate (incidents per 100,000 members of the population).</p>
</dd>
<dt>murder</dt><dd><p>murder rate (incidents per 100,000).</p>
</dd>
<dt>robbery</dt><dd><p>robbery rate (incidents per 100,000).</p>
</dd>
<dt>prisoners</dt><dd><p>incarceration rate in the state in the previous year
(sentenced prisoners per 100,000 residents; value for the previous year).</p>
</dd>
<dt>afam</dt><dd><p>percent of state population that is African-American, ages 10 to 64.</p>
</dd>
<dt>cauc</dt><dd><p>percent of state population that is Caucasian, ages 10 to 64.</p>
</dd>
<dt>male</dt><dd><p>percent of state population that is male, ages 10 to 29.</p>
</dd>
<dt>population</dt><dd><p>state population, in millions of people.</p>
</dd>
<dt>income</dt><dd><p>real per capita personal income in the state (US dollars).</p>
</dd>
<dt>density</dt><dd><p>population per square mile of land area, divided by 1,000.</p>
</dd>
<dt>law</dt><dd><p>factor. Does the state have a shall carry law in effect in that year?</p>
</dd>
</dl>
<h3>Details</h3>
<p>Each observation is a given state in a given year.
There are a total of 51 states times 23 years = 1,173 observations.
</p>
<h3>Source</h3>
<p>Online complements to Stock and Watson (2007).
</p>
<h3>References</h3>
<p>Ayres, I., and Donohue, J.J. (2003). Shooting Down the ‘More Guns Less Crime’ Hypothesis.
<em>Stanford Law Review</em>, <b>55</b>, 1193–1312.
</p>
<p>Stock, J.H. and Watson, M.W. (2007). <em>Introduction to Econometrics</em>, 2nd ed. Boston: Addison Wesley.
</p>
<h3>See Also</h3>
<p><code>StockWatson2007</code></p>
<h3>Examples</h3>
<pre><code class='language-R'>
## data
data("Guns")
## visualization
library("lattice")
xyplot(log(violent) ~ as.numeric(as.character(year)) | state, data = Guns, type = "l")
## Stock & Watson (2007), Empirical Exercise 10.1, pp. 376--377
fm1 <- lm(log(violent) ~ law, data = Guns)
coeftest(fm1, vcov = sandwich)
fm2 <- lm(log(violent) ~ law + prisoners + density + income +
population + afam + cauc + male, data = Guns)
coeftest(fm2, vcov = sandwich)
fm3 <- lm(log(violent) ~ law + prisoners + density + income +
population + afam + cauc + male + state, data = Guns)
printCoefmat(coeftest(fm3, vcov = sandwich)[1:9,])
fm4 <- lm(log(violent) ~ law + prisoners + density + income +
population + afam + cauc + male + state + year, data = Guns)
printCoefmat(coeftest(fm4, vcov = sandwich)[1:9,])
</code></pre>
</div>
</body></html>