As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
Has anyone implemented anything in FOCUS or webFocus using Benford's Law? Benford's law states that certain digits are more likely to occur in certain positions within a random number. For example, the number 1 has the highest probability of showing up in the first position of a number, and the number 9 has the least probability of showing up in the first position.
This law is often used in financial analysis to detect fraudulent/fictitious transactions. If anyone has done anything like this could you let me know. Thanks
Stephen AltroggeThis message has been edited. Last edited by: <Kathryn Henning>,
Do you mean in working out the probability that a series of numbers fall within Benford's law? Where, for the first significant digit of a given number 'n', the probability 'P', equates to Log10(1+1/n)
Shouldn't be too hard to manage given the formula.
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Yes that is exactly what I mean. I'm working with large volumes of transactions in flat files and am trying to determine the best way to implement the formula you mentioned. Any ideas?
Sorry it's taken a while to get back to you but try this for an example of your application. It uses the GGSALES file and shows that the figures are likely to be suspicious?
-SET &ECHO='ALL'; DEFINE FILE GGSALES DOLLARS_D/D12 = DOLLARS; DOLLARS_A/A1 = LJUST(12,FTOA(DOLLARS_D,'(D12)','A12'),'A1'); DOLLAR_CNT/I9 = 1; END TABLE FILE GGSALES SUM DOLLAR_CNT BY DOLLARS_A ON TABLE SAVE AS X FORMAT ALPHA END -RUN -SET &Sample = &RECORDS;
Firstly, in the defines, I convert the number in which I'm interested into Decimial notation as it is one of the formats required for FTOA.
Next I convert the number using FTOA (as opposed to EDIT which will show leading zeroes) and left justify the result. By setting the output format to A1 I effectively strip off the first significant digit.
The final define is just to show that I'm counting the rows and can be achieved many different ways.
The first table request is purely to dump the number of rows into a variable that I can use in the final calculations. I called it &Sample to depict that it represents the sample size.
In the final table request I cheated and used a decode to get the Benford's Law value for each digit as the only function close to a LOG is only for natural logs and not Log base 10 (which is what I needed).
The RATIO field shows what portion of the sample size is forecast by Benford's Law.
Hopes this helps in your quest!
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
You are most welcome and I must admit I enjoyed (OK I'm a sad case) coming up with the solution but then I enjoy those problems that tax the mind the most!!
Try the table in a graph instead, it gives a better "perspective" of the results!!
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Here is our model, similar to the one in this post, with a few modifications.
DEFINE FILE GGSALES
DOLLARS_D/D12 = DOLLARS;
DOLLARS_A/A1 = LJUST(15,FTOA(DOLLARS_D,'(D12)','A15'),'A1');
DOLLARS_I/I1 = EDIT(DOLLARS_A);
ONE/I1 = 1;
END
-*
GRAPH FILE GGSALES
-* y axis values.
SUM CNT.DOLLARS_A/I5C NOPRINT
TOT.ONE/I5C NOPRINT
-* Series 0.
COMPUTE ACTUAL_RATIO/D7.5 = CNT.DOLLARS_A / TOT.ONE; AS 'Actual'
AVE.DOLLARS_I NOPRINT
-* Series 1.
COMPUTE EXPECTED_RATIO/D7.5 = LOG( 1 + 1 / AVE.DOLLARS_I ) / 2.30259; AS 'Benford Expected'
-* x axis values.
BY DOLLARS_A AS 'First Position of Dollar'
-*
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET AUTOFIT ON
ON GRAPH PCHOLD FORMAT JSCHART
-*
ON GRAPH SET GRAPHSTYLE *
setY1ScaleMax(.5);
setTitleString("Reported/Recorded Amounts");
setSubtitleString("Actual v. Benford Expected Digital Frequency");
setY1TitleString("Frequency");
setTextRotation(getO1Label(),0);
setSeriesType(0,1);
setSeriesType(1,2);
setMarkerSizeDefault(160);
setMarkerShape(getSeries(1),10);
setSeriesLineWidthDefault(20);
ENDSTYLE
ON GRAPH SET STYLE *
INCLUDE = ENInformationBuilders_Light1, $
TYPE=REPORT, TITLETEXT='Actual v. Benford Expected Digital Frequency', $
ENDSTYLE
END
-EXIT
Indeed, per chart, the sales figures in GGSALES were probably human made. This probably was actually the case, unless there really was a Gotham Grinds coffee shop chain. :-)This message has been edited. Last edited by: David Briars,