Teaching for semester one has just ended. Almost all the undergraduates have left, and so campus is quiet in the run up to Christmas. But although the pressure is off (thankfully!), there are still things to do. In particular, I want to improve semester-two’s computational project on modeling the stock market. The current version is very popular with the students, but many of them slightly run out of steam when they do it, so I think there is room to improve it. The plot above shows some results for some calculations I am doing to scope out a new project.

The plot is obtained by starting with an initial amount of money, which I set to be £9,000, as that should be an amount of money our students can relate to. It is shown by the vertical red line. I then put the £9,000 into what is the simplest model for the price of a share, as a function of time. This model is what is called Geometric Brownian motion, which simply says that in any time interval, the share price changes by an amount that can be decomposed into two parts.

The first part is the average fractional change in share price in that time interval, and over short periods of time we assume that this does not change, i.e., this part of the change in share price is just a steady increase or decrease. By fractional I mean that the % change in share price is constant, for the simulation above, I chose a 0.1% fractional increase in share price each time interval.

The second part is a random fractional change, that changes from one time interval to the next; I take this to be random numbers with a standard deviation of 4% (and zero mean). The blue curve above is the probability density for the final funds obtained after investing an initial sum of £9,000, for 1,000 time intervals (within the model it does not matter what this interval is, if you like you can think of it as a day).

Now as the average fractional change is positive at +0.1%, if say all 400 physics undergraduates invested £9,000 each, then on average they would end up with about £25,000 each*. An average gain of £16,000 per student.

However, if we look carefully at the above plot, we see that the average does not tell the whole story. Note that the maximum in the probability curve is to the *left* of the vertical red line. In other words, for any given student the most likely outcome is that they lose money, in fact the most probable final amount a student ends up with is about £3,000, i.e., they lose £6,000.

At first sight, this looks inconsistent with the average gain being positive. But it is not because a few students gain huge sums, note that both axes are on a log scale and that the horizontal £ axis goes out to £100,000. If two students end up with £100,000 each but eight have £3,000 each, then on average they have £22,000, but this average is then very misleading as the money is distributed so unequally.

It is a generic feature of Geometric Brownian motion that a few rich get richer, while many poor get poorer — this is not a political point just a characteristic feature of the model — but of course it is quite a topical point. I will see next semester if the students find this feature interesting but I think it is quite striking.

* For Geometric Brownian motion, the average final funds are just £9,000 * exp[(0.1/100)*1,000], for 1,000 time intervals in each of which the share price goes up by an average of 0.1%. The arithmetic mean does not depend on the random part (when it has zero mean); this explained on the Wikipedia page.