forked from jasonlong/benfords-law
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
177 lines (156 loc) · 6.83 KB
/
index.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
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
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html lang="en">
<head>
<title>Testing Benford's Law</title>
<meta charset="utf-8" />
<meta name="description" content="An experiment to test Benford's Law against large, publicly available datasets." />
<meta name="author" content="Jason Long (@jasonlong) and Bryce Thornton (@brycethornton)" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link href="/css/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-584195-8']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="container">
<aside>
<h1>Testing <b>Benford's Law</b></h1>
<p>Imagine a large dataset, say something like a list of every country
and its population.</p>
<table>
<thead>
<tr>
<th>Country</th>
<th>Population</th>
</tr>
</thead>
<tbody>
<tr>
<td>Afghanistan</td>
<td><em>2</em>9,117,000</td>
</tr>
<tr>
<td>Albania</td>
<td><em>3</em>,195,000</td>
</tr>
<tr>
<td>Algeria</td>
<td><em>3</em>5,423,000</td>
</tr>
<tr>
<td>Andorra</td>
<td><em>8</em>4,082</td>
</tr>
<tr>
<td>Angola</td>
<td><em>1</em>8,993,000</td>
</tr>
</tbody>
<tfoot>
<tr>
<td> </td>
<td>↑ Leading digit</td>
</tr>
</tfoot>
</table>
<p>Chances are, the leading digit will be a <em>1</em> more often than
a <em>2</em>. And <em>2</em>s would probably occur more often than
<em>3</em>s, and so on.</p>
<p>This odd phenomenon is Benford's Law. If a set of values were truly
random, each leading digit would appear about <em>11%</em>
of the time, but Benford's Law predicts a logarithmic distribution.
It occurs so regularly that it is even used in fraudulent accounting
detection.</p>
<p>See the <a href="http://en.wikipedia.org/wiki/Benfords_law">Wikipedia article</a>
for a more thorough discussion.</p>
<p>This is a simple experiment to see how many large, publicly accessible datasets satisfy Benford’s Law.</p>
<p class="github">This site is on Github. Please <a
href="https://github.com/blackant/benfords-law">help out by forking
the project and adding more datasets</a>.</p>
<footer>
<p>
<a href="http://twitter.com/share" class="twitter-share-button" data-text="Testing the seemingly strange phenomenon of Benford's Law" data-count="horizontal" data-via="jasonlong" data-related="brycethornton">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</p>
<iframe src="http://www.facebook.com/plugins/like.php?app_id=177119802347764&href=http%3A%2F%2Ftestingbenfordslaw.com&send=false&layout=button_count&width=200&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:21px;" allowTransparency="true"></iframe>
<dl id="credits">
<dt>Concept, Design, & Frontend Development</dt>
<dd><a href="http://twitter.com/jasonlong">@jasonlong</a></dd>
<dt>Frontend Development & Data Crunching</dt>
<dd><a href="http://twitter.com/brycethornton">@brycethornton</a></dd>
</dl>
</footer>
</aside>
<section>
<h6>Available Datasets</h6>
<span id="dataset-wrapper"><select id="dataset-options"></select></span>
<header>
<h2 id="dataset-description"></h2>
</header>
<h6>Leading digit frequency</h6>
<ol id="chart">
<li><span class="fill" data-value="0"></span></li>
<li><span class="fill" data-value="0"></span></li>
<li><span class="fill" data-value="0"></span></li>
<li><span class="fill" data-value="0"></span></li>
<li><span class="fill" data-value="0"></span></li>
<li><span class="fill" data-value="0"></span></li>
<li><span class="fill" data-value="0"></span></li>
<li><span class="fill" data-value="0"></span></li>
<li><span class="fill" data-value="0"></span></li>
</ol>
<p id="benford-prediction"><b>▲</b> Predicted by Benford's Law</p>
<table id="stats">
<tr>
<td>Number of Records</td>
<td id="num-records"></td>
</tr>
<tr>
<td>Min Value</td>
<td id="min-value"></td>
</tr>
<tr>
<td>Max Value</td>
<td id="max-value"></td>
</tr>
<tr>
<td>Orders of Magnitude</td>
<td id="orders-of-magnitude"></td>
</tr>
</table>
<h6>Data Source:</h6>
<p><a id="data-source" href="#"></a></p>
</section>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="/js/app.js"></script>
<script src="/js/respond.min.js"></script>
<!--[if (gte IE 6)&(lte IE 8)]>
<script src="/js/selectivizr-min.js"></script>
<![endif]-->
<script type="text/javascript">
var clicky_site_ids = clicky_site_ids || [];
clicky_site_ids.push(66442290);
(function() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = '//static.getclicky.com/js';
( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
})();
</script>
<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/66442290ns.gif" /></p></noscript>
</body>
</html>