@QuasLacrimas @VirtuArete I can help you if you'd like. I have multiple processes for performing Benford's chi-squared tests using Python. If your data is available via link, let me know and I can customize a script for you and send it to you.
@QuasLacrimas @VirtuArete To speed things along, look at the following I'm posting. First use this to create the Benford's ratios:

def getBenfords():
expected = [log10(1+1/d) for d in range(1,10)]
return expected
@QuasLacrimas @VirtuArete Next, use this to perform the test
from scipy.stats import chisquare
benfords = get Benfords()
expectedvals = [sum(actualvals)*a for a in benfords]
actualpercent = [a/sum(actualvals) for a in actualvals]
chival,pval = chiTest(actualvals,expectedvals)
@QuasLacrimas @VirtuArete Next, use this to perform the test
from scipy.stats import chisquare
benfords = get Benfords()
expectedvals = [sum(actualvals)*a for a in benfords]
actualpercent = [a/sum(actualvals) for a in actualvals]
chival,pval = chiTest(actualvals,expectedvals)
@QuasLacrimas @VirtuArete In that second one, the "actualvals" is a list (or array) of frequency counts for digits 1-9, like this [30,18,13,10,8,7,6,5,4]

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Statsguyphd

Statsguyphd Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @statsguyphd

5 Nov
I am making these tweets to explain in one place some analysis that was done last night.
1 - I was asked offline about doing Benford's on election data. I explained that this is common and a useful way to detect anomalies in data that are driven by artificial process (e.g. fraud)
2 - My student then pointed me towards a tweet that was exploring this type of analysis (but they hadn't done Benford's). So I chimed in.
3 - However, I did not know what data they used so I found a source for the context they referenced. However, I could not initially find write-ins versus non-write-ins, so I looked at candidate counts.
Read 16 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!