Benford's Law: US Census Data I – Population Estimates

Note: Please adjust width of browser if only one column is visible.
[Click here for another Shiny app on Benford's Law]

The first-digit distribution of many US Census variables is known to closely follow Benford's Law. We will consider several census variables available from County Totals Dataset: Population, Population Change and Estimated Components of Population Change. The app will apply a goodness of fit test of the observed frequencies of first-digits for the selected variable. The variables under consideration are: Annual Resident Total Population Estimate (2010 to 2013), Annual Births (2010 to 2013), Annual Deaths (2010 to 2013).

Note: It may be the case that some variables do not closely adhere to Benford's Law according to the goodness of fit test. However bear in mind that relatively small deviations from what is expected can lead to a small P-value for the test due to a large sample size. Nevertheless, it is still interesting to see that, for any census variable from this app, the observed proportions of first-digits are not uniformly equal to 1/9 as one might expect and that Benford's Law can at least serve as a rough approximation.






Shiny app by Jimmy Doi
Base R code by Jimmy Doi
Shiny source files: GitHub Gist
Total Number of Counties in Data Set:
Census Variable:

Goodness of Fit Test:


                

Benford's Law: US Census Data II – QuickFacts

Note: Please adjust width of browser if only one column is visible.
[Click here for another Shiny app on Benford's Law]

The first-digit distribution of many US Census variables is known to closely follow Benford's Law. We will consider several census variables available from US Census State & County QuickFacts. The app will apply a goodness of fit test of the observed frequencies of first-digits for the selected variable. The variables under consideration are: Housing Units (2013), Households (2008-12), Veterans (2008-12), Nonemployer Establishments (2012), *Private Nonfarm Establishments (2012), *Private Nonfarm Employment (2012), *Retail Sales (2007).

*A small fraction (less than 2%) of the 3143 counties had entries of zero for the variables listed with an asterisk. For these cases, only the non-zero values were used for the goodness of fit test.

Note: It may be the case that some variables do not closely adhere to Benford's Law according to the goodness of fit test. However bear in mind that relatively small deviations from what is expected can lead to a small P-value for the test due to a large sample size. Nevertheless, it is still interesting to see that, for any census variable from this app, the observed proportions of first-digits are not uniformly equal to 1/9 as one might expect and that Benford's Law can at least serve as a rough approximation.






Shiny app by Jimmy Doi
Base R code by Jimmy Doi
Shiny source files: GitHub Gist
Total Number of Counties in Data Set:
Census Variable:

Goodness of Fit Test:


                

Benford's Law: Stock Exchange

Note: Please adjust width of browser if only one column is visible.
[Click here for another Shiny app on Benford's Law]

After a given day of trading, if we consider the first-digit of the volume of shares traded for each listed company in the New York Stock Exchange, the corresponding distribution will closely follow Benford's Law. Does the first-digit distribution for other variables such as a stock's closing cost closely follow Benford's Law? And does the specific stock market have any influence on the first-digit distribution of market variables?

This app will download information from the Wall Street Journal website from the most recent end of day market data. The data will be based on various market variables for all companies listed in one of four stock markets. The app will apply a goodness of fit test of the observed frequencies of first-digits for the selected variable in the specified stock market.

Note: It may be the case that some stock price variables do not closely adhere to Benford's Law according to the goodness of fit test. However bear in mind that relatively small deviations from what is expected can lead to a small P-value for the test due to a large sample size. Nevertheless, it is still interesting to see that, for any variable in this app, the observed proportions of first-digits are not uniformly equal to 1/9 as one might expect and that Benford's Law can at least serve as a rough approximation.







Shiny app by Jimmy Doi
Base R code by Jimmy Doi
Shiny source files: GitHub Gist
End of Day Market Data from:  

Market Source:
     Total Number of Stocks in Data Set:

Goodness of Fit Test: