Identify Claims, Check or Accounting Fraud: One Simple Check
Last Updated on July 24, 2023 by Editorial Team
Author(s): Mishtert T
Originally published on Towards AI.
Fraud Detection U+007C Implementation Example in R
Quick Way to Identify, Filter & Test Assumption of Fraud
Law of Anomalous Numbers (Benfordβs Law)
If you are reading a newspaper and you start writing down all the numbers that you see on that page and count occurrences of the first nine digits 1, 2, 3β¦..9.
What do you think the expected frequencies for these first digits?
Are you guessing it to be about 1/9? Well, you might be surprised by the answer.
Benfordβs Law: β is an observation about the frequency distribution of leading digits in many real-life sets of numerical data.
- 1st Digit ~30%
- 2nd Digit ~17%β¦
- 9th Digit ~4.6%
A dataset satisfies Benfordβs Law for the first digit if the probability that the first digit D1 equals d1 is approximately
A good place to start about Benfordβs Law & how and where it can be used and where not to be used would be Wikipedia.
How to use for analysis in R
Writing a simple function to test Benfordβs Law
ben_law β function(d) log10(1 + 1 / d);ben_law(1) --> 0.30103
Now, letβs test the law on powers of two and the Fibonacci sequence.
Fibonacci numbers commonly denoted by Fn, form a sequence, Fibonacci sequence, characterized by the fact that each number is the sum of the two preceding ones, starting from 0 and 1.
Generating first 1000 Fibonacci numbers:
n <- 1000;
num_fib <- numeric(n);
num_fib[1] <- 1;num_fib[2] <- 1;
for (i in 3:n) {num_fib[i] <- num_fib[i-1]+num_fib[i-2] }head(num_fib);
[1] 1 1 2 3 5 8
Generating first 1000 powers of 2:
power_2 <- 2^(1:n);
head(power_2)
[1] 2 4 8 16 32 64
The proof is in the plot
The below plot shows the conformity of the digits to the Benfordβs Law!!
package β benford.analysis available in CRAN
benford_fib <- benford(num_fib, number.of.digits = 1); plot(benford_fib)benford_power2 <- benford(power_2, number.of.digits =1);
plot(benford_power2)
Many datasets satisfy Benfordβs Law
- Numbers representing sizes of facts or events
- Numbers with no relationship to each other
- datasets that grow exponentially or arise from multiplicative fluctuations
- Mixtures of different data sets
Some Practical applicabilities:
- Electricity and telephone bills
- Accounting transactions
- Credit card transactions
- Customer balances
- Insurance claims
- Purchase orders
- Income data
- House prices
- Stock Prices
- Loan data
and many moreβ¦..
βFraud is typically committed by changing real observations or by adding invented numbersβ
Benfordβs Law Non-Conformance:
Sometimes (only some times), data doesnβt conform to Benfordβs Law.
- If data has an upper or lower boundary
- Data is concentrated in a narrow interval (height of people, hourly wage)
- Identification numbers (eg. Flight Number, Vehicle License Plate Numbers, Phone Numbers, Social Security Number)
- Additive fluctuations instead of multiplicative fluctuations (eg. heartbeat on any given day)
First-two digits Test
Benfordβs Law can also be used to test frequencies of first-two digits. This test is more reliable than the first digits test.
Just change the βnumber.of.digitsβ argument to 2 within the βbenfordβ function and youβre on your merry way to test the conformance of first-two digits.
Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.
Published via Towards AI