From 6c38632a15ec341466da661d3d4011f4ca1abaa7 Mon Sep 17 00:00:00 2001 From: gfreynoso <122997470+gfreynoso@users.noreply.github.com> Date: Thu, 26 Jan 2023 10:37:06 -0500 Subject: [PATCH] added the third digit probability --- benfordslaw/benfordslaw.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/benfordslaw/benfordslaw.py b/benfordslaw/benfordslaw.py index 4009988..f9c9bb4 100644 --- a/benfordslaw/benfordslaw.py +++ b/benfordslaw/benfordslaw.py @@ -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):