Tutoring Statistics Monte Carlo Simulation-5 Examples

Tutoring Statistics Monte Carlo Simulation

Introduction on Monte Carlo Method:

  • Monte Carlo simulation is the most common, popular and talked about simulation in Probability and Statistics topics. It is so because it is applied mathematics at its best that is used to solve so many real life scenarios everywhere from modeling risk assessment, evaluation of multidimensional definite integrals, gambling Physical sciences and a list of many more.

List of Areas where Monte Carlo Simulation is used:

  • Engineering
  • Climate change and radiative forcing
  • Computational biology
  • Computer graphics
  • Applied statistics
  • Artificial intelligence for games

Monte Carlo simulation is a stochastic simulation where the answer differs on each run of the simulation. Monte Carlo models differ in nature from simple models, two stage model and mixture models to Markov Chain.  What all of these methods have All MC methods share the concept of using randomly drawn samples to compute a solution to a given problem. The Monte Carlo method uses random sampling (or by the simulation of random variables) to solve mathematical problems.

 

 statistics-tutoring

“stochastic simulations, the answer will differ from run to run, because there’s an element of randomness in it.”

 

BASIC PRINCIPLES

Just as in Programming in any math theorem and method we must first realize what this method needs to function the inputs and the characteristic of each input,

And the outputs –what will this method yield after the process takes place.

 

 

The INPUTS in the Monte Carlo Simulation:

Parameters are uncertain and are to be estimated that is why each parameter is sampled. Can be a range of estimates.

The OUTPUTs in the Monte Carlo Simulation:

Can be a range of estimates.

The PROCEDURE in the Monte Carlo Simulation: Many results from each sample that goes thru the procedure. In complicated models such as Markov Chains the result is taken to adjust the input and the system in each iteration.

statistics-tutoring

EXAMPLE 1 easy dice:  The probability of rolling seven is equal to 6 divided by 36 = 0.167.  This probability can be found using Monte Carlo by rolling a die 100, 1000, and more times to see how many times the number seven occurs.  If I roll the die a 100 times and the number 7 occurs 32 times the probability would be 7/100.  You might ask this seems improbable and unrealistic why would such a method even work? Does this mean if I roll it 10000 times I will get a more accurate results than if I roll it 100 times, how would I know the number of times to roll the dice?  All are valid questions.

If it is true that the more samples you use, the closer the MC method gets to the actual solution, because we use random samples, a MC method can as well “just” randomly falls on the exact value by pure chance. In other words, on occasions, running a single MC simulation or integration will just give the right solution. However, on most occasions it won’t, but averaging these results will nevertheless converge to the exact solution anyway.

 

 

EXAMPLE 2:

Suppose you have three conditions (variables) as input, none of which you are sure about.

  1. Unit Cost– the cost of each unit.
  2. Selling Price of the Item – how much the item sells for.
  3. Sales Volume– how much of the item was sold.

We would like to estimate the Net Profit, the total profit that was made from selling the item. Net Profit = Sales Volume * (Selling Price – Unit cost) – Fixed costs

 

Range of estimates for the INPUTS:

The ranges for each parameter, with the most likely value given.

 

Process:

Excel has different distributions that can be used for sampling each parameter. A number is drawn from a selected distribution for a given parameter. Since we know the ranges and the most likely value for each variable we can choose the right distribution.

 

Range of estimates for the OUTPUTS:

Full range of all trial values for the Net Profit is calculated in excel.

Confidence interval can be found for the answer.

 

 

See original problem:

ww.solver.com/monte-carlo-simulation-example

This problem first uses the averages to find the answer, then introduces uncertainty.

See : finding confidence interval for each simulation here

Tutoring Statistics Monte Carlo Simulation

 

 

However in the strength of the MC methods also lies their main weakness. If by chance you sometimes get the right or close to the right solution with only a few samples, you may as well be unlucky at some other times, and need a very large number of samples before getting close to the right answer. Generally, the rate of convergence of MC methods (the rate by which the MC methods converge to the right result as the number of samples increases) is pretty low (not to say poor).

 

 

EXAMPLE 3:

There a huge project to be completed that has many minor jobs, the organizer does not know how many months it is going to takes for each job but wants to estimate how long it would take to complete the whole project.

 

Range of estimates for the INPUTS:monte-carol-simulation

Each job is a range of estimates from the minimum number to complete a job could be as little as 3 months to maximum number to complete each job.

 

From the data, the minimum number of months I s 11 and maximum is 19. Now we run a simulation that randomly generate values for each of the tasks, then calculate the total time to completion.

 

Process:

A random number is generated 500 times. If this number is less than or equal to the number of months for a task we keep a tally. For example, we generate a number from 12 to 19 the first time and it turns out to be 14. We mark the slot with 14 months. We do this process for 500 times.  Usually the more you do this process the more accurate the results will turn out.

 

Range of estimates for the OUTPUTS:11-19 months.monte-carol-simulation

 

Percent of the Total is found by taking the number of times we had a result fall on the slot and dividing it by 500. For example, percent of total for 14 months was calculated by taking 171/500 = 0.34 or 34%.

 

See original problem: https://www.riskamp.com/files/RiskAMP%20-%20Monte%20Carlo%20Simulation.pdf

 

EXAMPLE 4: Cookie Monster.

My friend is trying to loose weight and has been counting calories.

During the holiday season he has been invited to invited to between 1 and 4 parties, but most likely 2.  And at each party he will eat between 4 and 8 cookies, most likely 5.  Each cookie will contain between 35 and 120 calories, but most likely 50. Estimate the range for the calories consumed.

 

 

Range of estimates for the INPUTS:

tutoring-statistics-monte-carol-simulation

 Process:

Perform a 1000 runs of Monte Carlo simulation.  Unlike the previous example we cannot add all those parameters to make a total because each parameter is distinct and the question is not asking for the total parties, cookies and calories.  The question is asking about the calories consumed.  So, during each run we have to estimate the each of the parameters.

Run 1 : a random number within the range of a parameter is generated for a) parties b) cookies c) calories.

For example, for run 1 three numbers will be generated first will be between 1 and 4 for the parties, second will be between 4 and 8 for the cookies, and third will be between 32 and 120 for the calories.  Then the number of calories will be calculated for each run.

Range of estimates for the OUTPUTS:

The result will be a range of values for the total number of calories. This is the case because for the first run you might get 1 party, 4 cookies 34 calories each yielding a total of 136 calories. However on a 55thrun you might get a the maximum of 4 parties at each party you will eat 8 cookies of120 calories each, this totals to 4 * 8 * 120 = 3840. The ranges will depend on the results of your simulation from the smallest number of calories to the largest.

 

 

See original Problem:

https://www.risklens.com/blog/monte-carlo-simulation-101-in-5-minutes-video

 

EXAMPLE 5: Casino House always wins

Is it true that the longer you play in the casino the odds of winning actually decrease? Lets look at an example where you roll a pair of dice. Suppose each die is a range of values. If you roll a sum that is greater than 51 you win.

What happens if we simulate this game using Monte Carlo simulation, this will illustrate the risks of playing at the casino for a prolonged period of time.

 

 

Range of estimates for the INPUTS:

The money the player is starting with ($10,000). The amount the player bets in each game ($100).

Let us make ranges for the inputs, for example the number of games

1 – 5 games.

10 – 50 games.

50-100 games,

500-1000 games,

1000-10000 games.

Process:

The dice are thrown for each number of games played using a random number generator.  A pseudo-random number is generated by the computer, if that number is greater than 51, profit is calculated.

 

Range of estimates for the OUTPUTS:

The ranges of the Profits made for each interval.

1 – 5 games. ~Profits $9997-$9992

10 – 50 games. ~Profits $9958-$9922

50-100 games. ~Profits $9922-$9746

500-1000 games. ~Profits $9076-$8032

1000-10000 games. ~Profits -$10700

 

 

Instead of estimating the unknown parameter by a single value it provides more information to estimate it using ranges and confidence intervals.

 

 

See original Problem:

https://towardsdatascience.com/the-house-always-wins-monte-carlo-simulation-eb82787da2a3

 

Monte Carlo Simulation with Confidence intervals explained:

Youtube.com Tutoring Statistics Monte Carlo Simulation

Remember a confidence interval is simply an interval (range) of where the estimate is most likely to end up. The we can say with 95% confidence that the estimate will be in that range.

tutoring-statistics-monte-carol-simulation

Ref:s

  1. https://www.scratchapixel.com/lessons/mathematics-physics-for-computer-graphics/monte-carlo-methods-in-practice
  2. https://www.riskamp.com/files/RiskAMP%20-%20Monte%20Carlo%20Simulation.pdf
  3. https://www.youtube.com/watch?v=t0F3S-46bIQ
  4. https://www.risklens.com/blog/monte-carlo-simulation-101-in-5-minutes-video
0 0
More Posts

 

 

 

 

Please follow and like us:
Advertisements

Comments