-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pos < 0 results in incorrect probabilities #13
Comments
danielmccarville
changed the title
Last Digit position returns wrong probabilities
Pos < 0 results in incorrect probabilities
May 20, 2024
Dug into the repo more to figure out what's happening. The init method in benfordslaw (line 52) uses the absolute value of pos. That's not intuitive, since the distribution of the first digit and the last digit aren't related at all. Similarly, the distribution of the second digit and second-to-last digit aren't the same. I'd recommend removing that absolute value from all of them. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
benfordslaw() returns incorrect expected probabilities when pos < 0. This shows up clearly in the Example info: https://erdogant.github.io/benfordslaw/pages/html/Examples.html#last-digit-test.
The Example where pos=-1 shows that the the last digit is expected to be '1' about 30% of the time. That's not true. It appears to be using the formula for the first significant digit, instead of using convolution to find the probability of the n-th digit.
Recommended solution would be to restrict pos > 0.
The text was updated successfully, but these errors were encountered: