Download presentation
Presentation is loading. Please wait.
Published byLionel Newton Modified over 9 years ago
1
MATH 3033 based on Dekking et al. A Modern Introduction to Probability and Statistics. 2007 Slides by Sean Hercus Instructor Longin Jan Latecki Ch. 6 Simulations
2
What is a simulation? One uses a model to create specific situations in order to study the response of the model to them and then interprets this in terms of what would happen to the system “in the real world”. Models for such systems involve random variables, and we speak of probabilistic or stochastic models, and simulating them is stochastic simulation. Stochastic simulation of a system means generating values for all the random variables in the model, according to their specified distributions, and recording and analyzing what happens We refer to the generated values as realizations of the random variables
3
6.2 Generating realizations Simulations are almost always done by computer, which usually have one or more so- called (pseudo) random number generators. Which mimics U(0,1). Ex: How do you simulate a coin toss with a die. Bernoulli random Variables Suppose U has a U(0,1) distribution. To construct a Ber(p) random variable for some 0 < p < 1. so that
4
6.2 cont. Continuous Random Variables Suppose you have a distribution function F of a continuous random variable and you wish to construct a random variable with this distribution. If distribution F is one-to-one from 0 to 1 then F has an inverse denoted F inv : F(x) = u ↔ x = F inv (u) Now instead of a real number u, replace u with a U(0,1) random variable U {U ≤ F(x)} = {F inv (U) ≤ x} => P(U ≤ F(x)) = P(F inv (U) ≤ x) = F(x) where 0 ≤ F(x) ≤ 1
5
6.2 cont. Exponential random variables Applying this method to exponential distribution F(x) = 1 – e -λx if U has a U(0,1) distribution, then the random variable X is defined by So we simulated a Exp(λ) random variable using a U(0,1) random variable F(x) = u ↔ x = ln (1- u) = F inv (u) X = F inv (U) = ln (1- U) = ln (U)
6
6.2 cont. The restriction imposed earlier that the distribution function should be strictly increasing, is not really necessary. Furthermore, a distribution function can have jump discontinuities or flat sections as well. Ex 6.3 If F has a jump discontinuity at a, then P(X = a) = the size of the jump If F has a flat section on [x 1,x 2 ], then P(U = F(x)) on the flat section = 0 and F inv (F(x)) = any x on [x 1,x 2 ] See figure 6.2 Random number generators create realizations for a large number of random variables which mimics U(0,1). The sequence of U(0,1) random variables U 1,U 2,… Have the property that the events {U i ≤ a i } are independent for all a i
7
6.4 A single server queue There is a well and people want to determine how powerful of a pump they should buy. The more power would mean less wait times but also increased cost Let T i represent the time between consecutive customers, called interarrival time, e.g., the time between customer 1 and 2 is T 2. Let S i be the length of time that customer i needs to use the pump The pump capacity v (liters per minute) is a model parameter that we wish to determine. If customer i requires R i liters of water, then S i = R i / v To complete the model description, we need to specify the distribution of T and R Interarrival times: every T i has an Exp(0.5) distribution (minutes) Service requirement: every R i has U(2,5) distribution (liters)
8
6.4 cont W i denotes the waiting time of customer i, for customer W 1 = 0 since he doesn’t have to wait. Then the following waiting times depend on customer i-1: W i = max{W i-1 + S i-1 + T i, 0} See pg.81 We are interested in average waiting time: This is used for fig 6.7, which is the plot of (n, n ) for n = 1,2,… The average wait time for v = 2 turns out to be around 2 minutes The average wait time for v = 3 turns out to be around.5 minutes n=n=
9
6.4 Work in system One approach to determining how busy the pump is at any one time is to record at every moment how much work there is in the system. For example if I am halfway through filling my 4 liter container and 3 people are waiting who require 2, 3, and 5 liters, then there are 12 liters to go; at v = 2, there are 6 minutes of work in the system and at v = 3 there is just 4. The amount of work in the system just before a customer arrives equals the waiting time of the customer, this is also called virtual waiting time. Figures 6.8 and 6.9 illustrate the work in the system for v = 2 and v = 3
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.