# Investing Under Uncertainty: Mathematical Models and Computer Simulations

Alfinio Flores, University of Delaware

# Introduction

Mathematical modeling is stressed in the Common Core State Standards (Common Core State Standards Initiative, 2010) both as a content standard for high school and as a standard of mathematical practice for all ages. Modeling investment growth is one example mentioned for high school. Students need to experience mathematical models not only of deterministic situations but also of random phenomena. The following activities have students use computer simulations in the context of investing money with uncertainty. Students need to be able to interpret graphs of rational functions and have basic probability knowledge, such as if $$p$$ is the probability of winning and $$q$$ is the probability of losing, then $$p + q = 1$$. Students can download and run the simulations without needing any programming knowledge. By running many simulations, and comparing and contrasting the outcomes, students can learn that in probabilistic situations we can predict with some confidence the results for the long term, but that for small numbers of trials the results can vary widely.

## The Need for Bankroll Management

A particular investment may be a win or a loss for an investor. The uncertainty of investments can be better described and understood using probabilistic models rather than deterministic models. Investors, due to skill and experience, may have a favorable probability $$\left( p > .5 \right)$$, but even so, long losing streaks are not uncommon. Thus, it is important for investors to properly manage their bankroll, the total money that they can invest. For a long series of investments, is it better to invest each time a fixed amount, or a variable amount? Kelly developed a criterion that is used nowadays in investment theory and practice (“Kelly criterion,” n.d.). Students can use GeoGebra to develop a better understanding of the Kelly criterion, a real life long term optimal investment model, and Python programs to simulate and contrast two investment strategies.

## The Kelly Criterion

Kelly’s formula determines the optimal size of a series of investments to maximize the expected utility over long trials (“Kelly criterion,” n.d.). Considering simple investments with two possible outcomes, losing all the invested money, or winning with the corresponding payoff odds, the Kelly criterion indicates to invest the fraction $$f^* = \frac{bp-q}{b}$$ of the bankroll, where the quantities represent

$$f^*$$: fraction of the current bankroll to be invested.

$$b$$: net odds received ($$b$$ to 1).

$$p$$: probability of winning

$$q$$: probability of losing

Because $$p+q=1$$, students can rewrite the formula as $$f^* = \frac{p(b+1)-1}{b}$$.

## An Interactive Graph for the Kelly Criterion

Using GeoGebra, students can interact with the graph at https://beta.geogebra.org/m/CkxdBZ9n by seting the value of $$p$$ with a slider and graphing $$f^*$$ as a function of $$b$$. So, for $$p = 0.6$$ and $$b = 1$$, the Kelly criterion suggests investing 20% of the bankroll (Figure 1). For a fixed value of $$p$$, students can explore the relation between $$b$$ and $$f^*$$. For example, ask students to find a specific value that would suggest investing 35% of a bankroll. Let students discuss and describe how the fraction invested varies for different values of the odds. Students can identify the type of graph (a rational function, a hyperbola) and describe the two asymptotes. By dragging the slider, students can see how the graph changes for different values of $$p$$.

Figure 1. The Kelly criterion for b = 1 and p = 0.6

# Simulating Bankroll Management with Python

Python is a free programming language; different versions are available. We used Canopy, which has a friendly user interface (Enthought, 2014). Teachers or students can download Python. The file bankroll.py used in this article runs well with Python 3.x. After students download the file from http://udel.edu/~alfinio/bankroll.py, they need to right click and save it as a Python file (file extension .py). After opening the file with Python, in the “Run” menu select “Run File.” Students can then execute the different functions in the file by typing the name of the function with the desired value for the parameter, for example fixed(0.6), and pressing Enter or Return.

## Exploration of Investing a Fixed Amount

In this activity, students will learn that by investing a fixed amount, in the long term, investors can estimate their wins by using a linear function, but that for short sequences of investments the outcomes can vary widely.

Suppose a skilled investor can double the money invested 60% of the time ($$b = 1$$, $$p = 0.6$$). The other 40% of the time the investor loses the money. The starting bankroll is $1000 and$200 is invested each time. What is the expectation for this case? ($$0.6 \times 2 = 1.2$$) What is the expected net win for each investment? ($$\200 \times 0.2 = \40$$) What is the expected win after 200 investments? ($$200 \times \40 = \8,000$$)

We simulate the situation with the Python function fixed(p). The investor will make 200 investments or stop investing if the bankroll is depleted. Students can type fixed(0.6) to run the function for $$p = 0.6$$. Figure 2 shows two simulation examples for $$p = 0.6$$. Let students observe the graphs, discuss, and describe the results of different simulations, paying attention to the scale, identify interesting parts of the graphs, such as long losing streaks, and contrasting long-term predictions with short-term variability.

Figure 2a. Bankroll change with fixed investment amount, Example 1.

Figure 2b. Bankroll change with fixed investment amount, Example 2.

## Exploration of Using the Kelly Criterion

In these activities, students will learn that by using the Kelly criterion, in the long term, investors can make their bankroll grow much more than by investing a fixed amount, but that short sequences of investments can vary widely and include considerable losses.

We consider again two possible outcomes, one losing the entire investment and the other doubling the money ($$b = 1$$). The probability of winning is $$p$$ and $$q$$ of losing. For $$b = 1$$, Kelly’s formula is simply $$f^* = p - q$$. Thus, if an investor has a probability of 60% of winning, Kelly’s formula recommends investing 20% of the bankroll.

Students can run the function kelly(p) using $$p = 0.6$$. The initial bankroll is \$1000, and the investor will wager 200 times or stop investing if the bankroll is depleted. Figure 3 shows the results of two simulations for $$p = 0.6$$. When observing and discussing the graphs, students should pay special attention to the scale on the vertical axis.

Figure 3a. Bankroll growth with Kelly criterion, Example 1.

Figure 3b. Bankroll growth with Kelly criterion, Example 2.

Students can then run the program for $$p = 0.7$$ several times. What seems to be a modest increase in the favorable probability (from 0.6 to 0.7) can drastically change the outcomes.

# Final Remarks and Extensions

Bankroll management is also important in other contexts where people face uncertainty, such as professional gamblers. In this case too, bankroll management “should eventually reference the Kelly criterion.” (Luis Flores, personal communication, 2014). Other situations involving money and uncertainty can also be simulated using probabilistic models. Students can simulate the effect of different strategies for withdrawing money in retirement when the assets face unpredictable fluctuations, such as in the stock market.

# References

Common Core State Standards Initiative. (2010). Common Core State Standards for Mathematics. Retrieved from http://www.corestandards.org/Math/