0:00

This is an introduction to the Monte Carlo Simulation project.

Â So in this screen cast I'm going to kind of give you an overview of

Â what a Monte Carlo simulation is,

Â and why it is useful.

Â So a Monte Carlo simulation is a simulation that

Â takes into account the variability of the inputs.

Â So you have a complex process.

Â And, if it's simple enough,

Â you can just mathematically describe this.

Â To what it does, It takes into account variation in your inputs.

Â So, maybe you have inputs A, B,

Â C and D. And,

Â maybe A is a randomly distributed variable.

Â So it's a normally distributed variable.

Â So looks like a Bell Curve,

Â which means that there's some sort of

Â average or central tendency with a standard deviation.

Â So there's a lot of things,

Â a lot of variables that are normally distributed.

Â But maybe B is something different,

Â maybe it's uniformly distributed.

Â So maybe, there's an equal probability of getting anything between little a and little b.

Â So, for example this is if you have a six-sided dice,

Â there's a 1/6th chance that you'll get a one,

Â two, three, four, five or six.

Â So it's equally likely.

Â So maybe your process has some input B that has a uniform distribution.

Â You might have discrete variables.

Â So maybe you have one,

Â two and three are the different possibilities,

Â and each of those has its own probability.

Â So maybe, it will look something like this.

Â So that's a discrete input.

Â And, you can also have variables that have

Â some awkward shapes maybe like something like that,

Â where it's more likely to get something come on the right hand side of this distribution.

Â So, all of these inputs A, B,

Â C,D go into this process.

Â And this is normally described by some sort of mathematical process.

Â You've got all sorts of relationships between the different variables,

Â and the output then is really what you're interested in.

Â A Monte Carlo simulation looks at combining

Â the variability of all the inputs to get a distribution of the outputs.

Â So you're not just simulating at once,

Â you're not just using an A,a B,a C and a D,

Â but what you're doing is you're looking at maybe in a one thousand

Â to tens of thousands of different simulations.

Â Each of those one thousand to ten thousand simulations you're going to

Â randomly choose an A from its distribution,

Â randomly choose a B from its distribution and so on.

Â So you're just going to kind of at random choose combinations of A,

Â B, C and D just by chance, by random chance.

Â You're going to put those into your model process and you're going to get the output.

Â So for this example you might get,

Â some sort of probability distribution that looks like this.

Â It's not necessarily just a simple Gaussian curve because some

Â of the inputs are not normally distributed, like A.

Â The output usually has some sort of probability function, all right?

Â Which is shown here. And, you might be doing a financial project.

Â You might be looking at modeling and investment.

Â I'm not a business person,

Â but maybe each of your inputs A,

Â B, C, D has different probabilities or likelihoods.

Â And then you put this together into some sort of process.

Â And, maybe this is the profitability of your venture.

Â And, maybe these ones over here,

Â these are all profitable.

Â And that's actually sort of what the project is going to entail.

Â But maybe and maybe that's like 96% when you simulate it.

Â Four percent of the simulations is what this is telling you.

Â Four percent of the simulations,

Â the Monte Carlo simulations are giving a non-profit.

Â So no profit over here. All right.

Â So, a Monte Carlo simulation you look at

Â the variability of all the inputs you put into your process.

Â You do 1,000-10,000 different simulations.

Â For each simulation you're only choosing one value of each of the distribution.

Â So maybe this is you know,

Â by random chance this is 4.2.

Â This is 1.3.

Â You choose maybe when you do a simulation you get two,

Â is going to be your value because this is a discrete variable one,

Â two or three and then maybe here you get a value of 147.

Â And those all, depending upon what they are,

Â they go into your process.

Â And then you output for that single simulation maybe you get one number.

Â And maybe you're getting a profit of $10.1 thousand, right?

Â You do that 10,000 times and then you take the results of each of the simulations.

Â You take random inputs for each of the simulations and you create the output.

Â And then you plot that. And that's how you can determine,

Â you know 96% of our simulations led to a profitable venture.

Â So what is a probability density function?

Â We're going to be using a lot of these probability density functions in this project.

Â For discrete variables, this is also known as a probability mass function.

Â The important thing is that this represents probability.

Â And the area underneath the curve,

Â if it's a discrete variable like here,

Â the probability of all the bars always adds up to one.

Â So this is probability.

Â Example I have here is you flip two coins.

Â What's the probability that in those two coin flips you're going to get zero heads?

Â So that means this is also two tails.

Â So that's just one half.

Â For the first coin, is going to be the probability of getting a tail,

Â and one half for the second.

Â So it's 0.5 x 0.5 would be 0.25.

Â So that's the probability that you'll get two tails which is zero heads.

Â There's also a 50% probability to get one head.

Â So you can get head then tails,

Â or you get tails then heads.

Â So there's two possibilities out of four possibilities total.

Â And, so this ends up being a 50% probability that you

Â get exactly one head in two coin flips.

Â And similarly, there is a 25% chance that you'll

Â get two heads because you have a 1/2 chance in the first coin,

Â and a 1/2 chance in the second coin.

Â So that's equal to 1/4.

Â So a probability density function or a probability mass function.

Â You also see this probability distribution function

Â or just simply probability distribution.

Â It just sort of explains or describes the probability of getting certain outcomes.

Â Another example, this is a uniform distribution that

Â I touched on a few minutes ago, is a dice.

Â This is a uniform distribution because getting one, two,

Â three, four, five or six is equally likely.

Â So it's sort of just this flat distribution.

Â For a continuous variable,

Â where you can have a range of different values,

Â not just discrete one,

Â two, three and integer values,

Â it looks something like this,

Â where the area under this distribution is equal to one.

Â The Normal Distribution is the most common distribution.

Â I'll talk more about this in individual screen cast on each distribution.

Â But, many many objects,

Â times of something that costs

Â real world phenomena are characterized by a normally distributed variable.

Â The male height in a country,

Â female height is normally distributed.

Â Maybe if you have sugar packets that you're putting in your coffee,

Â if you weighed hundreds of those,

Â you would see that the following normal distribution, all right?

Â So about some average.

Â Manufactured parts.

Â You know the dimensions, the weights of

Â various manufactured parts are all oftentimes normally distributed.

Â So the normal distribution also known as the Bell curve or the Gaussian distribution.

Â So numbers kind of near the average are more common than in the tails.

Â So if this average is equal to five,

Â you know, i'd be unlikely,

Â but possible to get something way away from the average.

Â And it would be rare to get something like a one down here.

Â The standard deviation means that,

Â what it really means is,

Â 68% of the distribution is plus or minus one standard deviation of the mean.

Â So if I had a standard deviation which I represented Sigma equal to two,

Â then that would mean 68% of

Â all possibilities described from this distribution would lie between three to seven.

Â So that 68% will be between three and seven, all right?

Â That is unlikely to get something in the tails. All right.

Â So in subsequent screen cast,

Â I'm going to explain an example.

Â It's a Monte Carlo simulation of

Â a cookie recipe and the cost of cookies and the profitability of cookies.

Â