-
Notifications
You must be signed in to change notification settings - Fork 48
/
index.html
145 lines (125 loc) · 4.8 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
<!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" />
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script async defer data-domain="testingbenfordslaw.com" src="https://plausible.io/js/plausible.js"></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/jasonlong/benfords-law">help out by forking
the project and adding more datasets</a>.</p>
<footer>
<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>
</body>
</html>