I tried to create an SQL statement that calculates the frequency of appearance of the first digit of a population (column, like amount) and to compare to Benford's law (the expected number of occurences).
I came across this algorith in a different question:
Public Function BenfordsLaw(D As Integer) As Double
BenfordsLaw = Log(1 + (1 / D)) / Log(10)
Do you have an idea whether this is an SQL statement, if not is there an sql statement to compare the occurence of the first digit of a column to the expected occurence according to Benford's Law. I also need to calculate the Z-Scores (Z-stat ratios).