Skip to content

vishnuharidas/benfords-law

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Checking Benford's Law

From Wikipedia, Benford's Law is an observation that in many real-life sets of numerical data, the leading digit is likely to be small. In sets that obey the law, the number 1 appears as the leading significant digit about 30% of the time, while 9 appears as the leading significant digit less than 5% of the time.

Here's a graph generated from the publicly available data of surface area of countries:

Screenshot of Bar Chart showing Benford's Law

Usage

Optionally set up a Virtual Environment if you need by:

$ python3 -m venv .venv
$ source .venv/bin/activate

Install the dependencies by:

$ pip3 install -r requirements.txt

Run:

$ python3 benford.py

The script uses a publicly available data from this repository. You can try out different data available in the repository, or any other data source.

License

Copyright (c) 2023 Vishnu Haridas

This software is published under MIT License. See LICENSE.md for more details.

About

Checking Benford's Law on some available datasets online

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages