Presentation is loading. Please wait.

Presentation is loading. Please wait.

Monte Carlo simulation

Similar presentations


Presentation on theme: "Monte Carlo simulation"— Presentation transcript:

1

2 Monte Carlo simulation
Special Topics 3.58 Monte Carlo simulation Monte Carlo method

3 Two similar but different variations
Special Topics 3.59 Introduction Concept Inspired by ideas underlying gambling Randomness, either in inputs or model, … … exploited to explore range of possible outcomes Two similar but different variations Stochastic inputs, deterministic model, explicit time Deterministic inputs, stochastic model, implicit time

4 Special Topics Monte Carlo simulation 3.60 Stochastically varying
initial conditions Stochastically varying results MC v1 Deterministic simulation Probability distributions used to model variability in initial conditions Often time-stepped physics-based model; time represented explicitly Multiple runs with run-to-run variability in results; analyzed statistically Stochastically varying results MC v2 Fixed initial conditions Stochastic simulation Specific known or given initial conditions Probability distributions used to model variability in simuland processes; often no explicit representation of time Multiple runs with run-to-run variability in results; analyzed statistically v1 v2

5 Monte Carlo simulation (v1)
Special Topics 3.61 Definition Monte Carlo simulation (v1) Stochastically varying initial conditions input to deterministic physics or process model. Modeling Physics of simuland modeled using physics Time modeled explicitly, as time-stepped continuous Simulation Randomly generated initial conditions … … used to study range of possible results Usually multiple trials and statistical analysis

6 Monte Carlo simulation (v2) Fixed initial conditions input
Special Topics 3.62 Definition Monte Carlo simulation (v2) Fixed initial conditions input to stochastic physics or process model. Modeling Physics of simuland modeled using probability Time modeled implicitly, no explicit time advance Simulation Randomly generated physics outcomes … … used to study range of possible results Usually multiple trials and statistical analysis

7 Monte Carlo v1 method (alternative)
Special Topics 3.63 Monte Carlo v1 method (alternative) Defining a Monte Carlo model Identify a set of random variables that specify the initial condition. Select probability distribution and parameters for each. Develop deterministic model to calculate results from a set of inputs. Executing a Monte Carlo simulation Repeat for each of n trials: Randomly generate random variate for each input. Calculate trial outcome with deterministic model. Record trial outcome. Statistically analyze the results.

8 Monte Carlo v2 method (alternative) Defining a Monte Carlo model
Special Topics 3.64 Monte Carlo v2 method (alternative) Defining a Monte Carlo model Identify a set of input variables that specify the initial condition. Select specific values for each. Develop stochastic model based on probability distributions to calculate results from a set of inputs. Executing a Monte Carlo simulation Repeat for each of n trials: Initialize model with selected input values. Calculate trial outcome with stochastic model. Record trial outcome. Statistically analyze the results.

9 Monte Carlo simulation
Special Topics 3.65 Monte Carlo simulation Examples

10 Special Topics 3.66 Example 1 (MC v1): Calculating π
Overlay a unit circle arc over a square area. Choose a random x and y, and place a dot there. Repeat this step several times. Calculate π based upon this result (see next slide) 1 1

11 Assessing simulation output Want to approximate “real” value of π
Special Topics 3.67 Assessing simulation output Want to approximate “real” value of π 1 r 4 2 # dots inside circle  # dots inside entire square r  r 4  Example: π/4 ≈ 340/500 1 Simulated π ≈ 2.72 Error of 12.1% ? Can rerun with more samples to generate more accurate output 1

12 Special Topics Experimental results from implementation 3.68
Sample size # inside circle # inside square Simulated value of π Error 5 4 4.000 27.33% 10 1.600 49.07% 50 42 3.360 6.95% 44 3.520 12.05% 200 161 3.220 2.50% 500 387 3.096 1.45% 398 3.184 1.35% 1000 785 3.140 0.05% 795 3.100 1.32% 2000 1567 3.134 0.24% 1554 3.108 1.07% Total 5741 7315 3.139 0.07% Demo

13 earnings = unit price x unit sales – (variable costs + fixed costs) ?
Special Topics 3.69 Example 2 (MC v1): Product earnings Want to predict product earning in future years Historical data for last five years available Can develop a probability distribution Choose triangular distribution when given small amounts of data Need minimum, maximum, and mode (most likely) Use the following relation: earnings = unit price x unit sales – (variable costs + fixed costs) ?

14 Determining minimum, likely, and maximum
Special Topics 3.70 Determining minimum, likely, and maximum Historical data per year and “transformed” data: Year 1 Year 2 Year 3 Year 4 Year 5 Unit price 50 52 55 57 65 Unit sales 2000 2200 2700 2500 2800 Variable cost 50,000 55,000 56,000 57,000 58,000 Fixed cost 10,000 12,000 15,000 16,000 17,000 Earnings 40,000 47,400 77,500 69,500 107,000 Min Mode Max Unit price 50 55 70 Unit sales 2000 2440 3000 Variable cost 50,000 55,200 65,000 Fixed cost 10,000 14,000 20,000 Earnings 40,000 125,000 •Minimums •Averages •Best guesses

15 Special Topics Forming triangular distribution (b  a)(c  a) 0 3.71
Mode Max Unit price 50 55 70 Unit sales 2000 2440 3000 Variable cost 50,000 55,200 65,000 Fixed cost 10,000 14,000 20,000 Earnings 40,000 125,000 0.1 Probability 2(x  a) a  x  c (b  a)(c  a)  2(b  x) f (x)   (b  a)(b  c) c  x  b otherwise 0 50 (a) 55 (c) 60 Unit price 70 (b)

16 Special Topics 3.72 MATLAB code h = sqrt(rand(1,10000));
unit_price = (70-50)*h.*rand(1,10000)+55-(55-50)*h variable_costs = ( )*h.*rand(1,10000) ( )*h; fixed_costs = ( )*h.*rand(1,10000) ( )*h; unit_sales = ( )*h.*rand(1,10000) ( )*h; for i=1:10000 earnings(i) = unit_price(i)*unit_sales(i)- (variable_costs(i)+fixed_costs(i)) end

17 Earnings summary statistics
Special Topics 3.73 Earnings summary statistics 400 Parameter Value Mean 73,206 Median 71,215 Std Dev 16,523 Variance 273,009,529 Minimum 21,155 Maximum 137,930 300 Frequency 200 100 2 4 6 8 x104 Compare Earnings Min Most likely Max Earnings 40,000 65,000 125,000

18 Example 3 (MC v1): Missile impacts [Zhang, 2008] Application
Special Topics 3.74 Example 3 (MC v1): Missile impacts [Zhang, 2008] Application Deterministic 6DOF model of missile trajectory Used to calculate impact point given initial conditions Measure x and y error w.r.t. aiming point Compare model and live test x and y error variances Two ranges: 60 Km and 100 Km 6 live tests, 800 Monte Carlo model trials each range Monte Carlo analysis For each trial, generate trajectory initial conditions from probability distributions Calculate impact point Repeat for 800 trials Compare variances

19 Special Topics 3.75 Missile trajectory model Physics based
Organized into modules: velocity, rotation, atmospheric conditions, aerodynamics, thrust Implemented in MATLAB Simulink m dV  P cos  cos   X  mg sin  dt mV  p(sin  cos  v  cos  sin  sin  v )  Y cos  v  Z sin  v  mg cos  Velocity module equations d mV cos  dv  P(sin  sin   cos  sin  sin  )  Y sin   Z cos  v v v v dt Velocity module block diagram

20 Special Topics Impact data 3.76 Trial x error s y error s n Model
526.62 85.91 800 Test 566.66 89.77 6 60 Km Trial x error s y error s n Model 921.39 111.25 800 Test 980.52 120.68 6 100 Km

21 Special Topics Monte Carlo simulation
3.77 Monte Carlo simulation Case study: Bombing accuracy analysis (MC v2)

22 Special Topics 3.78 Bombing accuracy analysis
Bomber attack on ammunition depot Conventional (unguided) bombs Impacts randomly dispersed w.r.t aiming point, in both x (range) and y (azimuth) directions Impact within ammunition dump perimeter is hit

23 Special Topics Ammunition dump, 1996 [Banks, 1996] 3.79 1 (-504, 198)
y 2 (552, 18) –x x 950 m Aiming point (0, 0) –y 1250 m

24 Ammunition dump, 2010 [Banks, 2010]
Special Topics 3.80 Ammunition dump, 2010 [Banks, 2010]

25 Stochastic bomb impact model
Special Topics 3.81 Hits and misses Configuration Bomb aiming point is coordinate origin (0, 0) Bombers approach from west (left) Each bomber carries 10 bombs Stochastic bomb impact model Each impact assumed independent of others Normally distributed around aiming point Aiming point (0,0) is x mean, y mean x = 0, y = 0 x standard deviation x = 400 y standard deviation y = 200

26  X   x x  y Normally distributed random variates
Special Topics 3.82 Normally distributed random variates Random variate (rv) Specific number from a given distribution Randomly generated Normal random variates Normal distribution: mean μ and std dev σ Standard normal distribution: mean 0 and std dev 1 Normal rv X from standard normal rv Z: X = μ + Zσ Spreadsheet: =E4+E5*NORMSINV(RAND()) Given bomb impact coordinates X and Y normally distributed per μx, σx and μy, σy, equations for std normal r.v. Zx and Zy are Given standard normal r.v. Zx and Zy, solve equations for X and Y to get bomb impact coordinates  X   x X   y Z  Z X  400  Z Y  200  Z x y x y x  y μx = 0, σx = 400 μy = 0, σy = 200

27 Procedure for each trial
Special Topics 3.83 Procedure for each trial Generate standard normal random variates Zx, Zy Calculate impact coordinates X, Y from Zx, Zy using model Determine if impact point (X, Y) is within ammo dump Trial Zx X Zy Y Result 1 -0.84 -504 0.66 198 Miss 2 0.92 552 0.06 18 Hit 3 1.03 618 -0.13 -39 4 -1.82 -1,092 -1.40 -420 5 -0.16 -96 0.23 69 6 -1.78 -1,068 1.33 399 7 2.04 1,224 0.69 207 8 1.08 648 -1.10 -330 9 -1.50 -900 -0.72 -216 10 -0.42 -252 -0.60 -180

28 Simulated bombing runs [Banks, 2010]
Special Topics 3.84 Simulated bombing runs [Banks, 2010]

29 Special Topics Experiment results [Banks, 2010] 3.85
Sample 400 trial experiment results. Each trial 10 bombs. Frequency of number of bomb hits in a trial.

30 Special Topics Monte Carlo simulation Computing confidence intervals
3.86 Monte Carlo simulation Computing confidence intervals [Brase, 2009] [Petty, 2012] [Petty, 2013]

31 Example confidence interval
Special Topics 3.87 Example confidence interval . . . Sample of cereal boxes filled by machine 12.04 Sample size = 100 boxes Mean weight of sample = ounces Standard deviation of weight of sample = 0.1 ounces Confidence interval for mean weight ▪ Interval [ , ] Confidence level 0.95 (95%)


Download ppt "Monte Carlo simulation"

Similar presentations


Ads by Google