(1) 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 (2013 to 2016), Annual Births (2013 to 2016), Annual Deaths (2013 to 2016).

Note: It may be the case that some variables do not sufficiently 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:


                

(2) 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 sufficiently 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:


                

(3) Benford's Law: US Stock Markets

Note: Please adjust width of browser if only one column is visible.

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 sufficiently 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
 Currency:  
          End of Day Market Data from:  

Market Source:
     Total Number of Stocks in Data Set:

Goodness of Fit Test:



                

(4) Benford's Law: World Stock Markets

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

For the New York Stock Exchange (see previous tab), we found that the first-digit distribution of stock prices closely follows Benford's Law. Does Benford's Law also apply to the first-digit distribution for stock prices from other world markets? Does currency have any influence on the first-digit distribution of market variables?

This app will download market data from the Investing.com website. For the selected stock market, if trading is active at the point of data access, the results will be based on the most current market data. If the market is closed at point of access, then all information will be based on the most recent end of day market data. 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 sufficiently 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
 Currency:  
           Access Point:  

Market Status:
     Source:
     Total Stocks:

Goodness of Fit Test: