Unlock the full potential of AI with Building LLMs for Production—our 470+ page guide to mastering LLMs with practical projects and expert insights!


Identify Claims, Check or Accounting Fraud: One Simple Check
Latest   Machine Learning

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

Photo by Marvin Ronsdorf on Unsplash

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.

  1. 1st Digit ~30%
  2. 2nd Digit ~17%…
  3. 9th Digit ~4.6%
Expected Frequency — First Nine Digits

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] }
[1] 1 1 2 3 5 8

Generating first 1000 powers of 2:

power_2 <- 2^(1:n); 
[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);

Many datasets satisfy Benford’s Law

  1. Numbers representing sizes of facts or events
  2. Numbers with no relationship to each other
  3. datasets that grow exponentially or arise from multiplicative fluctuations
  4. Mixtures of different data sets

Some Practical applicabilities:

  1. Electricity and telephone bills
  2. Accounting transactions
  3. Credit card transactions
  4. Customer balances
  5. Insurance claims
  6. Purchase orders
  7. Income data
  8. House prices
  9. Stock Prices
  10. 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.

  1. If data has an upper or lower boundary
  2. Data is concentrated in a narrow interval (height of people, hourly wage)
  3. Identification numbers (eg. Flight Number, Vehicle License Plate Numbers, Phone Numbers, Social Security Number)
  4. 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.

Photo by NeONBRAND on Unsplash

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

Feedback ↓