This is the second post based on Sara Silverstein’s blog on Benford’s Law. Previously we duplicated the comparison of the proportion of first digits from a series of randomly generated numbers, and successive arithmetic operations on those numbers, and saw that the the more complicated the operation, the closer the conformance.
In this post we investigate the conformance with actual data, similar to Ms. Silverstein’s investigation of “all the values from Apple’s financials for every quarter over the past ten years.”
Four different types of financial documents from property/casualty insurance were investigated:
1. An exhibit of estimated ultimate loss using various actuarial methods, and related calculated values
2. A Massachusetts insurance company rate filing
In addition to many financial values, rate filings include much text and many numbers that are non-financial in nature.
3. An insurance company annual statement from 2009
Annual statements (aka, the Yellow Book) include many, many, many, many, many, many financial values.
4. Schedule P data compiled by the Casualty Actuarial Society
Schedule P for six different lines of business for all U.S. property casualty insurers can be found at this link. The six files were combined into a single document. To isolate the investigation to purely financial numbers sans labels, company codes, and the like, the columns investigated are “IncurLoss_”, “CumPaidLoss_”, and “BulkLoss_”.
Here are the results. The number of non-zero numbers in each document is indicated on the plot.
The Schedule P data is the most purely-financial in nature, and its plot in black matches Benford’s Law almost exactly. Perhaps surprising, the Exhibits document is also quite close even though it holds the least number of observations. Perhaps a better job of pulling purely financial numbers out of the Rate Filing and the Annual Statement would improve their conformance.
For reading PDF documents into R as text strings, I used the readPDF function in the tm package. Look at this link to learn how to download the binary files that make readPDF work easily, and the suggestion of where to store them for expediency.
To divide strings of characters into individual “words”, I used ‘scan’ in base R. See this link.
For parsing numbers, in all their various forms with commas, decimal points, etc., I used the parse_number function in the readr package.