Skip to content

Commit

Permalink
Merge pull request #12 from gfreynoso/patch-1
Browse files Browse the repository at this point in the history
Nice contribution! I added the third digit probability.
  • Loading branch information
erdogant authored Jan 27, 2023
2 parents 6966414 + 6c38632 commit 6e23082
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion benfordslaw/benfordslaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ def __init__(self, alpha=0.05, method='chi2', pos=1, verbose=3):
elif np.abs(pos)==2:
self.leading_digits = [12, 11.4, 10.9, 10.4, 10, 9.7, 9.3, 9, 8.8, 8.5]
self.digit_range = range(0, 10)
elif (np.abs(pos)>2) or (np.abs(pos)==0):
elif np.abs(pos)==3:
self.leading_digits = [10.2, 10.1, 10.1, 10.1, 10.0, 10.0, 9.9, 9.9, 9.9, 9.8]
self.digit_range = range(0, 10)

elif (np.abs(pos)>3) or (np.abs(pos)==0):
raise Exception('[benfordslaw] >There is no leading digit distribution specified for this digit!')

def fit(self, X):
Expand Down

0 comments on commit 6e23082

Please sign in to comment.