conceptual introduction
play

Conceptual Introduction Department of Veterinary and Animal - PDF document

1/13/2020 Department of Veterinary and Animal Sciences Department of Veterinary and Animal Sciences Outline 1. Conceptual introduction 2. Simulating the Monty Hall Problem 3. Simulating in Herd Management Monte Carlo Simulation I 4.


  1. 1/13/2020 Department of Veterinary and Animal Sciences Department of Veterinary and Animal Sciences Outline 1. Conceptual introduction 2. Simulating the Monty Hall Problem 3. Simulating in Herd Management Monte Carlo Simulation I 4. Exercises: SimBatch Anders Ringgaard Kristensen and Dan Børge Jensen Slide 2 Department of Veterinary and Animal Sciences Properties of methods for decision support Conceptual Introduction Department of Veterinary and Animal Sciences Department of Veterinary and Animal Sciences SimHerd: Example of a commercial herd simulation model SimHerd: Example of a commercial herd simulation model Specific dairy herd simulations: Used for decision making: - Milk yield - Investment decisions (technology, wellfare, etc.) - Feed usage - Management deisions - Reproduction - Disease prevalence - Death Jan Tind Sørensen, Søren Østergaard, Anne Braad Kudahl, Jehan Ettema 1

  2. 1/13/2020 Department of Veterinary and Animal Sciences Department of Veterinary and Animal Sciences But what is simulation? Different kinds of simulation Simulation is an attempt to model a real world Randomness (cf. Chapter 14.3 in textbook) system in order to: • Deterministic – forget it in herd management! • All calculations based on “average values” • Obtain a better understanding of the system • Same input → Same output (including interactions) • System comprehension • Physiological models • Differential equations, physiology (NorFor). • Herd models • “Probabilistic” models • All calculations based on distributions • Study the effects of various (complex) • Same input → Same output decision strategies • System comprehension, decision strategies • Markov chains (earlier this course) • Herd models • Stochastic (Monte Carlo) models • All random events are simulated by random number generation • Same input → Different output – i.e. we need many replications • System comprehension, decision strategies • Herd constraints, complexity Slide 7 Slide 8 Department of Veterinary and Animal Sciences Different kinds of simulation Hierarchy (levels) • Mechanistic: • A system is modeled by its elements (sub-systems) • A herd is modeled by its individual animals and their interactions. Simulating the • Empirical • Only one level modeled Monty Hall Problem • Output directly modeled from output Time • Dynamic • Static Slide 9 Department of Veterinary and Animal Sciences The Monty Hall Problem - again How to model the problem Earlier we solved the decision problem by use of Identify the variables: Bayesian networks and/or decision graphs. • True placement, ”True” ∈ {1, 2, 3} • First choice, ”Choice 1” ∈ {1, 2, 3} Alternative methods: • Door opened, ”Opened” ∈ {1, 2, 3} • Experiment – many replications needed • Second choice, ”Choice 2” ∈ {Keep, Change} • Simulation – create a simulation model • Reward, ”Gain” ∈ {0, 1000} Define a decision strategy (2 options): • Choice 2 = Keep • Choice 2 = Change 2

  3. 1/13/2020 Department of Veterinary and Animal Sciences A random number generator for this simulation Simulation procedure: Use dice Variables and decisions are simulated with random number generation. Host must place the reward behind an arbitrarily selected door: • Roll the dice: Some possible random number generators are: • 1 or 2: Door 1 • 3 or 4: Door 2 • A coin Uniform • 5 or 6: Door 3 • A dice distribution • Value of variable True determined as 1, 2 or 3 • A computer Participant must choose a door at random Coin: Probabilities Dice: Probabilities Computer: Density • Roll the dice: 1 1 1,2 • 1 or 2: Door 1 1 0,8 0,8 • 3 or 4: Door 2 0,8 0,6 0,6 • 5 or 6: Door 3 0,6 0,4 0,4 • Value of variable Choice 1 determined as 1, 2 or 3 0,4 0,2 0,2 0,2 0 0 0 1 2 1 2 3 4 5 6 0 0,2 0,4 0,6 0,8 1 Slide 14 Department of Veterinary and Animal Sciences Department of Veterinary and Animal Sciences Simulation procedure II Simulation procedure III Check whether True = Choice 1 Value of Choice 2 determined in accordance with the decision strategy • If yes (two options): • Roll the dice (or toss a coin) Define new variable Final guess ∈ {1, 2, 3} • 1, 2 or 3: Open the lowest door • If Choice 2 = Keep: number where i ≠ True • Final guess = Choice 1 • 4, 5 or 6: Open the highest door • If Choice 2 = Change: number where i ≠ True • Final guess = i , where i ≠ Choice 1 and i ≠ Opened • If no (only 1 option): • Open door i ≠ True and i ≠ Choice 1 • Value of Opened determined Slide 15 Slide 16 Department of Veterinary and Animal Sciences Department of Veterinary and Animal Sciences Simulation procedure IV Evaluation of strategies Define the strategy as Choice 2 = Keep Check whether Final guess = True • Repeat the simulation many times (e.g. 1000) and calculate the average gain under the • If yes: strategy. • Gain = 1000 • If no: Define the strategy as Choice 2 = Change • Gain = 0 • Repeat the simulation many times (e.g. 1000) and calculate the average gain under the Simulation completed! strategy. Compare the average gain under the two strategies and select the best. Slide 17 Slide 18 3

  4. 1/13/2020 Department of Veterinary and Animal Sciences Simulation procedure: Use computer 5-10 Minute Break Computer: Density 1,2 Exactly as before, except: 1 0,8 0,6 • Instead of rolling the dice, we let the 0,4 0,2 computer draw a random number r . 0 0 0,2 0,4 0,6 0,8 1 • Converting to variable value for True is done as follows: • If r < 0.33333: Door 1 • If 0.33333 < r < 0.66667: Door 2 • If r > 0.66667: Door 3 • (Similar for other variable values) Slide 19 Department of Veterinary and Animal Sciences Department of Veterinary and Animal Sciences Purpose of simulation (formally) The state of nature The purpose of a simulation usually is to calculate Let us take a look at the elements in the Monty the expected utility, Hall example: E( U ( Θ, Φ )) , under a certain decision rule, • The state of natue is: Θ (thetha, upper case) Φ = ( p t 1 , p t2 , p c 1 , p c 2 ) , where: , applied to a system with a given state-of-nature, p t 1 = probability that door 1 holds the prize Φ. (phi, upper case) p t2 = probability that door 2 holds the prize P c 1 = probability that door 1 was the player’s first choice P c 2 = probability that door 2 was the player’s first choice This problem may be very difficult (or impossible) to solve numerically. A value could for instance be φ = (1/3, 1/3, 1/3, 1/3). The correct solution might not seem immediately intuitive! Slide 22 Department of Veterinary and Animal Sciences Department of Veterinary and Animal Sciences 7 minute mini-exercise! State of nature, I In the example the state of nature has been Download and open the quiz.R script • regarded as fixed and known Φ 0 = (1/3, 1/3, 1/3, 1/3) 1. Take a moment to familiarize yourselves with the functions defined in the upper part of the script Assume that the host has a favorite door, e.g. door a. Where are random numbers generated? • 3. He places the reward behind Door 3 with b. How are the random numbers generated? probability 0.8 and behind each of the others with probability 0.1. 2. Run the simulation with the two strategies at the bottom of the script The participant does not have a favorite door. • a. What is the chance of winning with each of the strategies? State of nature under those circumstances would be • Φ 0 = (0.1, 0.1, 1/3, 1/3) 3. Keep the script open for the next few slides! Does it change anything? Let’s try! • Slide 23 Slide 24 4

  5. 1/13/2020 Department of Veterinary and Animal Sciences Department of Veterinary and Animal Sciences State of nature, II State of nature, III Assume further that also the participant has a Finally, assume that the participant has a • • favorite door, Door 3. He also selects (first different favorite door, Door 1. He then selects choice) Door 3 with probability 0.8 and each of (first choice) Door 1 with probability 0.8 and the others with probability 0.1. each of the others with probability 0.1. State of nature under those circumstances, – The host still prefers Door 3 as before. • • when both have Door 3 as their favorite door, would be State of nature under those circumstances • Φ 0 = (0.1, 0.1, 0.1, 0.1) would then be Φ 0 = (0.1, 0.1, 0.8, 0.1) Does it change anything? Let’s try! • Does it change anything? Let’s try! • Slide 25 Slide 26 Department of Veterinary and Animal Sciences State of nature, IV In general, the optimal decision rule as well as the expected result depend on the state of nature. The state of nature in a livestock simulation model might be: • Average growth rate Simulating in • Herd mortality rate • Average milk yield Herd Management • … Is the true state of nature known (with certainty)? • Does it matter? Slide 28 Department of Veterinary and Animal Sciences Department of Veterinary and Animal Sciences State of nature, livestock models Simple example, I In livestock models we never know the true state of nature. We need to represent the uncertainty of the state of nature. We typically have some ideas – a belief in the true values. The belief may be represented as a statistical distribution. Slide 29 5

Recommend


More recommend