Вы находитесь на странице: 1из 14

Introduction to Monte Carlo

Simulations
Jeremy Daily
Jackson Hole Scientific Investigations
www.jhscientific.com

Walking Speed
4.10

3.90

3.70

Speed (mph)

3.50

3.30

Walking Speed

3.10

2.90

2.70

2.50
1

11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57
Sample Number

Walking Speed
4.50

4.00

3.50

Speed (mph)

3.00

2.50
Walking Speed
2.00

1.50

1.00

0.50

0.00
1

11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57
Sample Number

Statistical Deception
Graphs are skewed to show some bias
Look carefully at the labels and axes
Look at the number of samples (the larger
the better)
If no variation is mentioned, be skeptical
The biggest culprit
BIASED SAMPLING!!!

Coin Toss
Flip a coin ten times and count the number
of heads
Construct a table of results
Count

Number 0 1
of heads

10

Binomial Distribution

What about 100 tosses?


What is the probability of
getting exactly 50 heads?
What about the chances of
getting 50 heads or lower?

Theoretical Probability for 10


Tosses:
0 Heads: P = 0.0010
1 Heads: P = 0.0098
2 Heads: P = 0.0439
3 Heads: P = 0.1172
4 Heads: P = 0.2051
5 Heads: P = 0.2461
6 Heads: P = 0.2051
7 Heads: P = 0.1172
8 Heads: P = 0.0439
9 Heads: P = 0.0098
10 Heads: P = 0.0010

Probability Mass Function of Binomial Distribution, n = 10


0.25

0.2

Probability

0.15

0.1

0.05

4
5
6
Number of Heads

10

Cumulative Probability
Gives probability of something being lower than x.
Cummulative Mass Function of Binomial Distribution, n = 10
1

Cummulative Probability

0.8

0.6

0.4

0.2

4
5
6
Number of Heads

10

Probability Mass Function of Binomial Distribution, n = 20


0.18
0.16
0.14

Probability

0.12
0.1
0.08
0.06
0.04
0.02
0

8
10
12
Number of Heads

14

16

18

20

Probability Mass Function of Binomial Distribution, n = 100


0.1
0.09
0.08
0.07

Probability

0.06
0.05
0.04
0.03
0.02
0.01
0

10

20

30

40
50
60
Number of Heads

70

80

90

100

Probability Mass Function of Binomial Distribution, n = 100


0.1
0.09
0.08
0.07

Probability

0.06
0.05
0.04
0.03
0.02
0.01
0
30

35

40

45
50
55
Number of Heads

60

65

70

Normal Distribution
As n increases the binomial distribution
approaches the Gaussian or normal distribution

pdf ( x) =

1
2

( x )2 / 4 2

68% of data is within 1 stdev


86% of data is within 2 stdev
99% of data is within 3 stdev
Central Limit theorem:
Summation of distributions tends toward normal!!

Other Distributions

Lognormal
Raleigh
Uniform
Triangular
Poisson's
Weibul

Simulations
Random number generators are the core
of simulation.
Coin and die tossing is a form of random
number generation
Computers can do may iterations quickly.
Example for traffic crash reconstruction
Combined Speed

Estimated Probability Density Using Monte Carlo Simulation, M = 1000


1

Mean = 62.4842, Standard Deviation = 0.49274

0.8

pdf

0.6
0.4
0.2
0
60.5

61

61.5

62
62.5
63
Combined Speed (mph)

63.5

64

Estimated Cumulative Distribution Function Using Monte Carlo, M = 1000


1.2
Range = 61.0059, 63.9624
Traditional Range = 59.5819, 65.3146

CDF

0.8
0.6
0.4
0.2
0

61

61.5

62
62.5
63
Combined Speed (mph)

63.5

64

64.5