# On The Wealth Of Stations

As much as I enjoy the Baron's tall tales, I am no more convinced of their veracity than I am of his fervent belief that the nobility enjoy the benefits of their station because they are of better mettle than the likes of you and I. No, I am rather of the opinion that serendipity, above worthiness, maketh man!
To investigate the possibility that luck might well account for the elevation of the few above the many, my fellow students and I naturally turned to the mathematical arts and we resolved to create a series of games with which we might model the ebb and flow of prosperity.

### A Model Of Prosperity

We began with a particularly simplistic game, which we plan to improve upon though the lessons that we have learned by the study of it. Specifically, it is a game of chance in which each player begins with the same funds and at each turn all have exactly the same chances of gaining or losing a share of them.
To determine that share we employed a uniformly distributed random variable to produce values between a lower bound, representing a loss, and an upper bound, representing a profit, so that each player's funds changes according to the rule
\begin{align*} u &\sim U(a, b)\\ x &\leftarrow x \times u \end{align*}
where $$U(a, b)$$ stands for the uniformly distributed random variable, with lower and upper bounds of $$a$$ and $$b$$ respectively, and $$x$$ for said player's funds.
As simplistic as this game is, it does at least reflect the fact that the more one is able to invest in a venture, the more one stands to gain or lose.

Now, rather than play the game ourselves, we directed Professor B------'s remarkable Experimental Clockwork Mathematical Apparatus[1] to do so for us since it can play dozens of turns in the time that it would take us to play but one!
Deck 1 demonstrates the progress of this game for one hundred players with a profit or loss of up to five percent at each of one thousand turns.

Deck 1: Our Simplistic Game

The red line here shows the funds with which the players began the game.

Whilst the rules of the game apply equally to all players, so that none of them have any particular advantage over their fellows, there are invariably a few who profit greatly and many more who fare a good deal worse, as is made clearer by deck 2 in which the players are shown from the most to the least prosperous at each turn.

Deck 2: Sorted By Decreasing Funds

### Applying The Theory Of Wager

This came as no great surprise to my fellow students and I since the rules of the game are so simplistic that the likelihoods of the outcomes for each player can be figured with the theory of wager, and are immediately recognisable to those who have made it their study.

Specifically, if a player begins with funds of $$x$$ and gains, or loses if negative, a proportion $$u_i$$ of their funds on turn $$i$$ then their funds at turn $$n$$ will be
$x \times u_1 \times u_2 \times \dots \times u_{n-1} \times u_n$
which we may more succinctly express with
$x \times \prod_{i=1}^n u_i$
where $$\prod$$ is the product sign, standing for the product of the term upon its right for every value in the range of the index shown beneath it to the value above it.
Such products of values taken by random variables are, most always, very very nearly governed by the log normal distribution which has a probability density function, or PDF, of the form
$p_{\mu,\sigma}(x) = \frac{1}{\sqrt{2\pi}\sigma x} e ^{-\tfrac{(\ln x - \mu)^2}{2\sigma^2}}$
where $$\mu$$ is the mean of the logarithm of the values that it might produce and $$\sigma$$ is their standard deviation. Recall that the PDF generalises the notion of the probability of observing one of a finite number of possible values to random variables that can take on any possible value within the range that they admit with the integral
$\Pr(a < X \leqslant b) = \int_a^b p(x) \, \mathrm{d}x$
We may also use it to figure the expected value of any particular function $$f$$ of a random variable $$X$$ whose distribution has that PDF with
$\mathrm{E}[f(X)] = \int_{-\infty}^\infty f(x) \times p(x) \, \mathrm{d}x$
Given that the probability density function of a uniform random variable is simply
$p_{a,b}(x) = \frac{1}{b-a}$
for all $$x$$ between $$a$$ and $$b$$ and zero everywhere else, and noting that by the product rule
$\frac{\mathrm{d}}{\mathrm{d}x} \left(x \ln x - x\right) = \ln x + x \times \frac{1}{x} - 1 = \ln x$
the mean of its logarithm is thusly given by
\begin{align*} \mu = \mathrm{E}[\ln X] = \int_a^b \ln x \times p(x) \, \mathrm{d}x &= \int_a^b \ln x \times \frac{1}{b-a} \, \mathrm{d}x\\ &= \frac{1}{b-a} \times \int_a^b \ln x \, \mathrm{d}x\\ &= \frac{1}{b-a} \times \left[x \ln x - x\right]_a^b\\ &= \frac{1}{b-a} \times \left(\left(b \ln b - b\right) - \left(a \ln a - a\right)\right)\\ &= \frac{(b \ln b - a \ln a) - (b-a)}{b-a}\\ &= \frac{b \ln b - a \ln a}{b-a} - 1 \end{align*}
To figure the standard deviation of the logarithm of a uniform random variable we shall need the expected value of the square of its logarithm, for which we must use the rule of integration by parts which states that
$\int f \times \frac{\mathrm{d}g}{\mathrm{d}x} \, \mathrm{d}x = \bigg[f \times g\bigg] - \int \frac{\mathrm{d}f}{\mathrm{d}x} \times g \, \mathrm{d}x$
If we choose
\begin{align*} f &= (\ln x)^2\\ g &= \frac{x}{b-a} \end{align*}
then, by the chain rule, we have
$\frac{\mathrm{d}f}{\mathrm{d}x} = 2 \times \ln x \times \frac{\mathrm{d} \ln x}{\mathrm{d}x} = 2 \times \ln x \times \frac{1}{x}$
and consequently
\begin{align*} \mathrm{E}\left[(\ln X)^2\right] = \int_a^b (\ln x)^2 \times \frac{1}{b-a} \, \mathrm{d}x &= \left[(\ln x)^2 \times \frac{x}{b-a}\right]_a^b - \int_a^b 2 \times \ln x \times \frac{1}{x} \times \frac{x}{b-a} \, \mathrm{d}x\\ &= \frac{1}{b-a}\left[x(\ln x)^2\right]_a^b - 2 \times \int_a^b \ln x \times \frac{1}{b-a} \, \mathrm{d}x\\ &= \frac{b(\ln b)^2 - a(\ln a)^2}{b-a} - 2 \times \mu \end{align*}
The variance of a random variable $$X$$, being the square of its standard deviation, is given by
\begin{align*} \sigma^2 = \mathrm{E}\left[(X-\mu)^2\right] &= \mathrm{E}[X^2 - 2 \times \mu \times X + \mu^2]\\ &= \mathrm{E}[X^2] - \mathrm{E}[2 \times \mu \times X] + \mathrm{E}[\mu^2]\\ &= \mathrm{E}[X^2] - 2 \times \mu \times \mathrm{E}[X] + \mu^2\\ &= \mathrm{E}[X^2] - 2 \times \mu \times \mu + \mu^2\\ &= \mathrm{E}[X^2] - \mu^2 \end{align*}
and so the variance of the logarithm of a uniform random variable takes the form
\begin{align*} \sigma^2 &= \frac{b(\ln b)^2 - a(\ln a)^2}{b-a} - 2 \times \mu - \mu^2\\ &= \frac{b(\ln b)^2 - a(\ln a)^2}{b-a} - (\mu+1)^2 + 1\\ &= \frac{b(\ln b)^2 - a(\ln a)^2}{b-a} - \left(\frac{b \ln b - a \ln a}{b-a}\right)^2 + 1 \end{align*}
Finally, by the properties of logarithms, we have
$\ln \left( \prod_{i=1}^n u_i\right) = \sum_{i=1}^n \ln u_i$
where $$\sum$$ is the summation sign, and so the mean and variance of the logarithm of a product of $$n$$ of them are trivially given by $$n \times \mu$$ and $$n \times \sigma^2$$.

To confirm that these do indeed yield the correct mean and variance of the logarithm of such products, deck 3 compares their results with the observed mean and variance of a great number of them.

Deck 3: Observed And Exact Values

If you run this deck many times over, you will see that the observed mean and variance are always close to the exact values predicted by our formulae, sometimes slightly above and sometimes slightly below, inspiring some confidence in their correctness.

### The Implications Of Log Normality

To get a feel for whether or not the results of our work are in accord with the outcomes of the game that we have seen, we can sketch out the shape of the log normal PDF having the log mean and variance that we have deduced, as we have done with deck 4.

Deck 4: The Shape Of The PDF

Here the ticks upon the $$x$$ axis mark off the integers, so that the first represents the funds that the players begin with, the second twice those funds, the third thrice and so on.
This most certainly implies that the most common outcome for a player is a loss and that a lucky few will profit greatly, just as we have observed. To conclusively demonstrate that we have reckoned correctly, however, we must compare the probabilities of outcomes within a number of ranges with those predicted by our particular log normal distribution.

We can do this most easily with the cumulative distribution function, or CDF, given by
$P_{\mu,\sigma}(x) = \int_0^x p_{\mu,\sigma}(z) \, \mathrm{d}z$
so that
$\Pr(a < X \leqslant b) = \int_a^b p_{\mu,\sigma}(x) \, \mathrm{d}x = \int_0^b p_{\mu,\sigma}(x) \, \mathrm{d}x - \int_0^a p_{\mu,\sigma}(x) \, \mathrm{d}x = P_{\mu,\sigma}(b) - P_{\mu,\sigma}(a)$
and deck 5 compares a histogram of the outcomes of the game with a graph of those predicted by the CDF in exactly this manner.

Deck 5: Comparing The Histogram And The CDF

A most compelling demonstration that our reasoning has been sound!

Furnished with this result, we can easily reckon the chances that a player will conclude the game with less than any given fraction of their original funds, or with greater than any given multiple of them for that matter, as shown by deck 6.

Deck 6: The Chances Of Losses And Gains

Somewhat more difficult to figure are the chances that a player who began the game with a run of bad luck will ultimately prosper beyond a player who had better fortune, which we can write as
$\Pr(x_1 \times X_1 > x_2 \times X_2)$
where $$x_1$$ and $$x_2$$ are those players' funds partway through the game and $$X_1$$ and $$X_2$$ are the products of their random outcomes thenceforth.
If we treat this probability as a function of $$X_2$$ we can calculate its expected value with
\begin{align*} &\int_0^\infty \Pr(x_1 \times X_1 > x_2 \times x) \times p_{\mu,\sigma}(x) \, \mathrm{d}x\\ &\quad\quad= \int_0^\infty \Pr\left(X_1 > \frac{x_2 \times x}{x_1}\right) \times p_{\mu,\sigma}(x) \, \mathrm{d}x\\ &\quad\quad= \int_0^\infty \left(1 - \Pr\left(X_1 \leqslant \frac{x_2 \times x}{x_1}\right)\right) \times p_{\mu,\sigma}(x) \, \mathrm{d}x\\ &\quad\quad= \int_0^\infty \left(1 - P_{\mu,\sigma}\left(\frac{x_2 \times x}{x_1}\right)\right) \times p_{\mu,\sigma}(x) \, \mathrm{d}x\\ &\quad\quad= \int_0^\infty p_{\mu,\sigma}(x) \, \mathrm{d}x - \int_0^\infty P_{\mu,\sigma}\left(\frac{x_2 \times x}{x_1}\right) \times p_{\mu,\sigma}(x) \, \mathrm{d}x\\ &\quad\quad= 1 - \int_0^\infty P_{\mu,\sigma}\left(\frac{x_2 \times x}{x_1}\right) \times p_{\mu,\sigma}(x) \, \mathrm{d}x \end{align*}
Whilst we cannot simplify this integral any further, we can approximate it algorithmically, as is done by deck 7.

Deck 7: The Chance Of A Comeback

It is evidently rather unlikely that an unlucky player might turn the tables upon his luckier fellows, showing that the chances of a comparatively prosperous outcome are much improved by a fortuitous outset!

### In Conclusion

Whilst this is very much in concert with my own feelings upon the matter, I cannot in fairness draw any conclusions regarding the role of chance in the wealth of man since the game is far, far too poor a model of such; a criticism that I have no doubt the Baron and his kin should delight in pointing out!
Nevertheless, we have at least seen how to ask the questions that I should very much like answered; given perfectly equal opportunities, what are the chances that a few will profit greatly above the many, and what are the chances of a reversal of fortune?
$$\Box$$

### References

[1] On An Age Of Wonders, www.thusspakeak.com, 2014.