2nd - 3rd - 4th digit test

Background: 

This script will perform the 2nd, 3rd and 4th digit test which is based on Benford's Law.  The test is based on Mark J. Nigrini's book Benford's Law Applications for Forensic Accounting, Auditing, and Fraud Detection.  The script will create one file for each digit test.

Feb 14, 2013 - Updated for IDEA v9.

Documentation: 

' IDEAScript :  Benford 2nd - 3rd - 4th - digit test.iss
' Author :  Brian Element
' Date :   August 7, 2012
' Purpose :  This test will create up to 3 files, one for the 2nd digit test, one for the third
'  and one for the 4th digit test.
'  The test is taken from the following book:
'  Nigrini, Mark J. PhD, "Defining the First and First-Two Digits" Benford's Law
'  Applications for Forensic Accounting, Auditing, and Fraud Detection.
'  Hoboken, New Jersey, Page 6
'*****************************************************************************************************

This script will perform the 2nd, 3rd and 4th digit test as outlined in Mark J. Nigrini's book Benford's Law
Applications for Forensic Accounting, Auditing, and Fraud Detection based on the expected percentages as listed on page 6 of this book.

When you run the script you will be given the following menu.

 

The menu allows you to select the file you wish to perform the analysis on, choose a client field (such as a vendor) and the corresponding amount field.  The analysis will be performed on each individual client within the database.

The script also allows for optional fields as works in the same way as selecting optional fields when performing a summary.

The script also can be run on positive or negative values and it can be run on clients that have a certain number of transactions.  Benford's analysis is best run on clients that have a larger number of transactions.

You can choose one or all of the Digit Tests to be run.

 

The output will be similiar to the above screen shot.  It will show the client (in this case the Vendornum), the second digit that is based on the amount field.  The total records for that cleint, that actual number of records for that client based on the second digit.  The expected result which is based on the table from Mark Nigrini's book.  The difference between the actual and expected and the percent difference.

Note: There is currently one limitation to this test.  If a client does not have a digit, so in the case of the second digit test if there is no 3 in any of the amounts there will be no record for the 3 and as such there would be no expected result when the action would be 0.