[MUSIC] Decision making under uncertainty, one of our central themes really throughout this MOOC. So I think it is a great moment to introduce our final application in this final week of the MOOC for which I bring you Monte Carlo simulation. Remember the importance of mean and variance. Mean telling you what on average is going to happen, variance, a great thing to quantify the risk of some undertaking. So remember the different kinds of decisions we have to make under uncertainty. To study or not to study, to invest or not to invest, to marry or not to marry. because we can never know for sure what's going to happen. Perhaps the best we can hope for is if we could have a measure of what we could expect to happen and also a quantification of the risks involved. So Monte Carlo simulation is a great technique for allowing us to come up with an expected outcome. And very importantly the quantification of that risk. If we back track momentarily to the decision tree analysis problem we looked at at the start of this week we have this ice cream manufacturer. We solved for some expected monetary values from the different choices of to advertise or not to advertise. Yet we failed to consider the risks involved. Now we've noted in the last few sections how different people will have different attitudes to risk. Some people will be risk averse. Some people will be risk loving. Now I don't care which way you lie on that risk spectrum. But I think it is helpful to be able to quantify the risks associated with various projects such that if you can give the decision maker that information, then he or she can make an informed judgment about whether to undertake the project, but being informed of the risks involved. So to illustrate this we, as usual, take a simple example. Imagine we are deciding whether to invest or not to invest in some project. Such that we are going to launch a new product to the market. So this will clearly be determined on whether this is going to be a profit making or loss making exercise. Of course, we cannot know today for sure today whether we will make profits or losses. But let's make an assumption about the possible revenue streams that we may experience, and also the possible cost streams which we may experience. Of course, revenue will be affected by consumer demand, whether people like our product or not, there could be uncertainties in terms of our costs as well. Maybe some unreliable suppliers of our raw materials, that may disrupt the supply chain side. So at the heart of Monte Carlo simulation, in our model we're going to need to model some probability distributions, so think back to those simple distributions we looked at back in week two. Trivial examples like the score on a fair die. We also had the distribution example, you know success and the failure. The probability of the success pi, and the probability of failure, 1 minus pi. So in order to construct a Monte Carlo simulation model, we're going to need some input variables. But these indeed, are going to be random variables with corresponding probability distributions. So imagine in our to invest or not to invest a decision, let's consider the following probability distribution for the revenues. So let's consider the following possible revenue stream. So we cannot know for sure what the revenues will be. But let's entertain three distinct possibilities. Either we make 50,000 pounds, 80,000 pounds, or 100,000 pounds. And this will depend on whether consumers really take to our product or not. So these are the three possible values for the revenue, but now we need to attach a probability distribution to these, ie., how likely are these different outcomes. So let's assume, all right, that word assume, we are going to have to make assumptions in this Monte Carlo simulation model. But let's suppose there was a 20% chance of 50,000 pounds in revenue, 40% chance of 80,000 pounds and another 40% chance of 100,000 pounds. So we've had to create a probability distribution, similarly on the cost side, we have some uncertain costs. And those costs, let's say, could either be 30,000 pounds, 60,000 pounds, or 80,000 pounds. And we will assume a following probability distribution for those outcomes occur with probabilities not 0.2, not 0.6, and not 0.2, respectively. Now note, these are assumptions. And later on once we've solved our Monte Carlo simulation model we should pay some consideration to how appropriate those probability distributions are. But nonetheless, you can see now how we have uncertain revenues and also uncertain costs. And how therefore does Monte Carlo simulation work? When we simulate, we're going to simulate multiple possible futures, such that in any given future world, we will experience one of those revenues and one of those costs, and the difference between them will be the profit or possibly loss, that we experience. So how do we conduct a single simulation? Well, if we can do one, we can then iterate this a large number of times. So we're going to need a random number generator. Remember the different sampling techniques we reviewed earlier in the course. Remember simple random or something where we're going to appeal to that kind of concept here. So if we use a pseudo-random number generator, Microsoft XL has a very easy to access at random number generator. If you use the RAND function, what it will do is return a random number between zero and one, so over this unit interval such that all values within this interval are equally likely. So in our first simulation, we need to simulate a revenue and subsequently a cost. So remember our probability distribution for the revenues. The 50,000, 80,000 and 100,000 pounds occurring with probabilities 0.2, 0.4 and 0.4 respectively. So if we appealed, let's say, to this random number generating function, to generate a random number between zero and one. Or we can say that as it's equally likely to be anywhere along this interval then clearly there's a 20% chance that that random number is between 0 and 0.2. A 40% chance that random number is between 0.2 and 0.6, and of course a 40% chance that it's between 0.6 and 1. So depending on which random number was generated, this would then corresponds to that particular revenue being achieved. We can then apply exactly the same principle to randomly generated or simulating one of the costs. Of course, there we have opted for a different probability distribution where by those three different cost levels occur with probabilities 0.2, 0.6 and 0.2 respectively. And hence, for example, the random number between 0 and 0.2 would indicate one cost, between 0.2 and 0.8 another and 0.8 and 1 a third. So if we independently simulate a revenue and a cost, then depending what those values are. We can simply take their difference and this would equate to their profit or lost experience. For example, if we have randomly generated a revenue of 100,000 pounds and cost of only 30,000 pounds. We've made a 70,000 pound profit. So if this eventuality happened, of course, we'd be very happy with this outcome. But of course, we're not guaranteed to get a profit. If our revenue's, let say were only 50,000 pounds, but our costs were 80,000 pounds then that would translate to a loss of 30,000 pounds. So when we simulate a revenue and a cost we will get a, our profit. Might of course be negative and hence a loss. So that would indicate a one simulation, but with Monte Carlo simulation we don't just want to do this once we want to iterate this a very large number of times. Now, how many is a large number? Well, ideally we'd want to run this simulation thousands of times maybe hundreds of thousands of times. Now in the age of modern computers and for a very simple Monte Carlo simulation model such as this, a computer can iterate through many simulations of this very quickly indeed. But now you can see that in different simulations the revenue and/or cost will vary. And subsequently the profit or loss will vary across these different worlds. Now, of course, we do not know today which of those future worlds would occur, but what we're trying to simulate here is a probability distribution of outcomes. Such that depending on that uncertain revenue and depending on that uncertain cost, these combined to give us an uncertain profit, or if it's negative, a loss. So if we ask the computer to run through many of these simulations we could do some simple data visualization, perhaps a histogram of the outcomes which are generated. And this will show us the distribution for the profits if we were to undertake this investment. Now, as we know, a histogram is looking at displaying the entire sample distribution, when typically we may wish to focus on one or two key attributes of that distribution. And as I hope we know by now, things like the mean and variance, or perhaps its square root, the standard deviation, are some of those very important at summary statistics. So if we simply took the average of all of these profits which were simulated, we can view this as a quantification of the expected outcome. The expected profit, in this instance. But very importantly with this Monte Carlo simulation. As we simulated a distribution of outcomes, we can also quantify the risk, we can quantify the uncertainty attached to this endeavor through either the variance or the standard deviation of those profit outcomes. So of course, armed with this, this does not tell us what to do. But these are the critical pieces of information you would be able to give to the decision maker. Then he or she depending on his or her attitude and appetite for risk can make an informed judgement about whether to undertake the investment project or not. If you can tell them what the expected outcome is but also perhaps quantify how or what's the probability that this project ends up in a loss and also what might the maximum possible loss be for example. These are very important pieces of information which allow people to make informed decisions. Even though we still face uncertainty. I'm sorry there's nothing I can do about that. We can never eliminate uncertainty from our decision making. But if we can come up with a fairly accurate quantifications of risk then it allows us to make an informed judgement aware of the risks involved and depending on our risk appetite, will decide to undertake some endeavor or we won't. So perhaps a final closing point, this was a very simple Monte Carlo simulation model. But note those key inputs, the probability distributions for the revenues and also the costs. Whose to say I am right in that distribution of revenues and costs. Whose to say there are only three possible revenues or three possible costs. There could be a continuum of them and even if we we're right with those three distinct revenues and three distinct cost, whose to say the choice of probability distributions that we've used is appropriate. So now we're getting into a little more complicated territory because we've just perhaps solved this motto for setup that we've chosen. We've assumed particular probability distributions. Remember in week one, I told you to beware any assumptions you make in a model. Because if you make wrong assumptions, it may lead you to draw erroneous conclusions. So I'll just perhaps leave you with this thought. If you were to conduct a Monte Carlo simulation, or indeed a decision tree analysis, or indeed a linear programming problem. Of course, when we solve these, we need to be mindful that the results, the outcomes we derive are likely to be sensitive to certain ingredients to our models. For example in this Monte Carlo case, the expected profit we obtain, the quantification of risk that we come up with, it's likely to be sensitive to our choice of probability distribution for the revenues and also the costs. So in serious simulation work, one should really undertake something called a sensitivity analysis. Because you want to know how robust or the opposite of that how sensitive are the outcomes, the expected profit, the standard deviation of profits side. How sensitive are these values to things such as those input probability distributions. So now you can perhaps appreciate the complexities that involve Monte Carlo at simulations because you might want to experiment with many different types of probability distributions for the revenues and the cost. Who knows there maybe some interdependent between those revenues and cost which in very simple model we fail to account for. So you can now start to hopefully appreciate how we could extend this into modeling very complex situations which would involve very large numbers of variables. An array of different probability distributions we could perhaps attach to them. But at perhaps the big picture level I hope you can takeaway from this the great potential of Monte Carlo simulation to allow us to come up with an expected outcome of when we are undertaking decision making under uncertainty. And very importantly be able to try and quantify the risks involved. [MUSIC]