I was watching a show on Netflix last night on Benford's Law and wondered if it would hold in the "fake worlds" I create in simulation. This is a quick drive-by only. The basic idea of "the Law" is something I extracted (selectively and exclusively) from Wikipedia:
- Benford's law, also called the Newcomb–Benford law, the law of anomalous numbers, or the first-digit law, is an observation about the frequency distribution of leading digits in many real-life sets of numerical data. The law states that in many naturally occurring collections of numbers, the leading digit is likely to be small.[1] For example, in sets that obey the law, the number 1 appears as the leading significant digit about 30% of the time, while 9 appears as the leading significant digit less than 5% of the time.
- It has been shown that this result applies to a wide variety of data sets, including electricity bills, street addresses, stock prices, house prices, population numbers, death rates, lengths of rivers, and physical and mathematical constants.
- It tends to be most accurate when values are distributed across multiple orders of magnitude, especially if the process generating the numbers is described by a power law (which are common in nature).
- P(d) = log10(1+1/d) where d is digit and the base can be extended to other bases and this gives the following distribution
d Relative size of 1 30.1% 2 17.6% 3 12.5% 4 9.7% 5 7.9% 6 6.7% 7 5.8% 8 5.1% 9 4.6% - Many real-world examples of Benford's law arise from multiplicative fluctuations.[25] For example, if a stock price starts at $100, and then each day it gets multiplied by a randomly chosen factor between 0.99 and 1.01, then over an extended period the probability distribution of its price satisfies Benford's law with higher and higher accuracy.
-----
I do quite a bit of simulation around net-wealth processes so I figured I'd use that as a test. Since that process is a multiplicative markov chain that I'm pretty sure is a martingale (except for consumption maybe but idk) it seems like it would satisfy the conditions of the Benford situation. Let's take a look.
First, I'll set up a super simple net wealth process working in wealth units (1/spend so 1/.04 = 25 units) and normally distributed returns, so like this:
- W(0) = 25
- returns = N(.04,.12)
- years in (33,100)
- iterations in (300000,200000)
- terminal net wealth is rendered in absolute value
- unit consumption per period = 1
The idea is run the above in simulation, extract the terminal net-wealth info at t=[30 or 100], strip out the first digits of abs(terminal net wealth), create relative frequencies and then chart the relative frequencies from simulation against Benford above and see what happens.
Scenario 1. Iterations = 300,000; years = 33 [in blue]. Benford = red dots
Discussion
- Going on nothing other than my eyeball, it looks like it is playing the Benford game which was the point of the post so: so far so good,
- Minor variation may come from simulation instability,
- Other parameterizatons have not been checked but likely to be the same; TBD
- I guess I am both surprised and not. I thought simulation might be like a double compression of an image, or over-gaming elections, where the Benford curve starts to go away, the idea here being that simulation isn't real so maybe something would be lost in fake world. I'm not surprised because we are working with a multiplicative process that with enough time, spans a lot of orders of magnitude. Plus the price evolution of a stock price is lognormal as is the distribution of the net wealth process (pretty sure, gotta check on that one). Wealth over time plays a power law game and so does Benford.
- Maybe this could be a test for doctored simulations ;-)
No comments:
Post a Comment