Stat 330 1 Homework 10 Spring 2009 Webpage Counter Assume that hits on a webpage occur at a rate of 2 per minute. The hits occur independently, and the times between the hits have iid exponential distributions with a rate of λ. (a) Based on the problem description, what is the numerical value of λ for this scenario? Since the arrival rate is 2 hits per minute, λ = 2. (b) Suppose we start monitoring the webpage at 12:00pm. The 5 numbers below are iid realizations from a standard uniform distribution. 0.026 0.11 0.97 0.38 0.74 Use the 5 standard uniform realizations to simulate the times of the first five hits. Sketch a graph of the number of hits plotted as a function of time. Let Xi denote the time between arrival i − 1 and arrival i. We can generate the times between the arrivals by converting the 5 iid U (0, 1) random variables to 5 iid Exponential random variables with a rate of λ = 2. Using the inverse method for continuous random variables, if U ∼ U (0, 1), then a way to genrate X ∼ Exponential(λ) is to set X= 1 ln(1 − U ). λ Transforming the 5 uniform numbers above in this way gives the inter-arrival times in the following table. The fourth and fifth rows of the table also show the arrival times and the corresponding number of arrivals. i ui xi = −.5ln(1 − ui ) Time Since 12:00 (in Minutes) Number of arrivals 1 0.026 0.0132 0.013 1 2 0.11 0.0583 0.0714 2 3 0.97 1.753 1.825 3 4 0.38 0.239 2.064 4 5 0.74 0.674 2.737 5 (c) Suppose we monitor the webpage for two minutes. Let W be the number of hits in the first two minutes. What is the distribution of W? The Explain how to use the five realizations of the standard uniform distribution above to simulate the number of hits in the first two minutes. What value of W do you get? W is the number of hits in the first two minutes. W ∼ Poisson(λt). In this case, λ = 2, and t = 2, so λt = 4; W ∼ Poisson(4). The table above shows that the third arrival occurred at 1.82 minutes, and the fourth arrival occurred at 2.06 minutes. Because O3 = 1.82 < 2 < 2.06 = O4 , there were three hits on the webpage in the first two minutes: W = 3. 2 Hits on a web site The number of hits on a popular Web page follows a Poisson process with an arrival rate of 5 per minute. One begins observation at exactly noon tomorrow (WOI standard time). Let X(t) be the number of hits on the webpage by time t. 1 (a) What is the distribution of the number of hits in the first minute? Give the name of the distribution and the value(s) of parameter(s). What is the probability of 4 or less hits in the first minute? Let X(t) be the number of hits in the first t minutes. Then, X(t) ∼ Poisson(λt). In this case, λ = 5, and X(1) is the number of hits in the first minute. X(1) ∼ Poisson(5) (b) What is the distribution of the time until the first hit? Give the name of the distribution and the value(s) of parameter(s). Compute the probability that the time till the first hit exceeds 10 seconds. The time until the first hit is an Exponential random variable with rate parameter λ = 5 per minute. In other words, defining O1 to be the time until the first hit, O1 ∼ Exponential(λ = 5). To keep the units the same, use 10 sec=1/6 min to calculate the probability. P (O1 > 1/6min) = 1 − (1 − e−5·1/6 ) = e−5/6 = 0.4346 (c) What is an appropriate distribution for the time until the 4th hit? State the distribution and parameter value(s). O4 , the time until the 4th hit, has an Erlang distribution with a stage paramter of k = 4 and a rate parameter of λ = 5 – i.e, O4 ∼ Erlang(4, 5) (d) Evaluate the probability that the time till the 4th hit exceeds 24 seconds. P (O4 > 24/60) = 1 − P (O4 ≤ 0.4) = 1 − Erl4,5 (0.4) = 1 − (1 − P o5·0.4 (4 − 1)) = P o2 (3) = 0.8571. (e) Find the mean and the variance of the time till the 4th hit. E[O4 ] V ar[O4 ] k = 4/5 = 0.8 minutes = 48 seconds. λ = 4/52 = 0.16 minutes2 . = (f) The number of hits in the first hour is Poisson with mean 300. You would like to know the probability of more than 350 hits. Exact calculation isn’t really feasible. So approximate this probability and justify your approximation. X(1h) = X(60) ∼ P o300 ≈ N300,300 . By the CLT, we can use the normal distribution to approximate the Poisson with λ = 300. Then: P (X(60) > 350) 1 − P (X(60) ≤ 350) ≈ 1 − N300,300 (350) = 350 − 300 = 1 − N0,1 ( √ ) = 1 − N0,1 (2.89) = 300 = 1 − 0.9981 = 0.0019. = Notation: N0,1 (·) = Φ(·) 2 3 Convenience Store A small but busy convenience store has room in its building for only 4 customers. It has 2 employees who work (interchangeably) waiting on customers and performing other tasks (such as stocking shelves). The work rule the employee follow is this: When there are 3 or 4 customers in the store, both wait on customers. When there are 2 or fewer customers in the store, only 1 employee waits on customers. Customers arrive at the store according to a Poisson process with rate λ = 1 (and go away if there is no room in the store). We will assume that they spend no time finding their items and that either employee can service them at a rate µ = 0.8. (a) Carefully draw an appropriate birth and death process transition rate diagram for this scenario. 1 1 0 1 0.8 1 2 0.8 1 3 1.6 4 1.6 (b) What is the (large t) probability that there is no customer in the store? From the above diagram we know, that 1 = p0 + 1 1 1 1 1 1 1 1 p0 + p0 + p0 + p0 = 1 + + + + ·p0 2 2 1.6 2 1.62 0.8 0.82 0.82 1.6 0.82 1.62 0.8 0.8 0.8 0.8 | {z } S Therefore p0 = S −1 = 0.1852. (c) Let X be the number of customers in the store (for large t). What is the probability mass function (pmf) of X? k P (X = k) = pk 0 0.1852 1 2 3 4 1 ( 0.8 )(0.1852) 1 ( 0.8 2 )(0.1852) ( 0.812 1.6 )(0.1852) ( 0.8211.62 )4 (0.1852) (d) What is the probability that there are less than 3 customers in the store? P (X(t) < 3) = P (X(t) ≤ 2) = (p0 + p1 + p2 ) = .1852(1 + 1 1 + 2 ) = 0.7061. .8 .8 (e) What is the probability that an arriving customer is turned away? An incoming customer is turned away if the customer arrives when there are already four customers in the shop. The probability is therefore p4 = 0.1130. 3 4 Digital Communication System A secure digital communications system has a receiving station with a CPU that can decode messages at a rate of 1 per minute, and a buffer that will hold up to 3 of these messages. Suppose that messages arrive according to a Poisson process with rate .7 per minute. Making the assumption that decode times are exponential random variables, answer the following questions about the large t behavior of the receiving station. (a) Draw a state diagram of the number of messages in the system. 0.7 0 0.7 0.7 1 1 2 1 0.7 3 1 4 1 (b) What fraction of the time is the CPU idle? The probability that the CPU is idle is p0 , i.e. in p0 · 100% of all times, we will find the CPU to be idle. p0 is therefore also the fraction of time in which the CPU is idle. We compute p0 from the above state diagram by: p0 = S −1 = 1 + .7 + .72 + .73 + .74 −1 = 1 − .7 = 0.3606. 1 − .75 (c) Let X be the number of messages in the system (for large t). What is the probability mass function (pmf) of X? k P (X = k) = pk 0 .3606 1 .7(.3606) 2 (.7)2 (.3606) 3 (.7)3 (.3606) 4 (.7)4 (.3606) (d) What fraction of incoming messages are lost (i.e. arrive when the buffer is full)? Arrivals get turned away, if the system is full already, i.e. if the system is in state 4. The system is in state 4 with probability p4 = 0.74 · p0 = 0.0866. A fraction of 8.66 % of incoming messages are lost. (e) What is the mean number of messages in the system? What is the mean number of messages in the buffer? L = E[X(t)] = 0 · p0 + 1 · p1 + 2 · p2 + 3 · p3 + 4 · p4 = 1.3232. Let Y = Number in buffer. Since Y is a function of X, we can calculate the E[Y ] since we know the pmf of X. X P (X = k) = pk Y 0 .3603 0 1 .7(.3606) 0 2 (.7)2 (.3606) 1 E[Y ] = 0 · po + 0 · p1 + 1 · p2 + 2 · p3 + 3 · p4 = 0.638 4 3 (.7)3 (.3606) 2 4 (.7)4 (.3606) 3 5 Bank Robberies Chicago has been struck by a crime wave. Alarmed by the increasing number of bank robberies and concerned about their effect on bank customers, the Banking Upper Management Society (BUMS) adopts the following policies at each bank: • one teller’s window is reserved for the exclusive use of bank robbers. • in order to conserve space, bank robberies may be committed only by a lone bandit. • if two or more robberies occur simultaneously, the robbers are served on a first-come, first-serve basis. You are engaged as a consultant by the Bank Robbers Federation (BARF). Your job is to determine if the proposed arrangement with the BUMS is adequate. The data you are given is: • Robbers arrive at random 24/7 (during open hours), the average arrival rate is 2 robberies per hour. • Teller service is exponential with an average of 10 min (special robber withdrawal forms expedite service) You are asked to determine (a) the probability that there is no robber in the bank (large t probability). The number of robbers in the bank at time t can be modelled by an M/M/1 queueing system with arrival rate λ = 2 (per hour) and departure rate γ = 6 (per hour). This gives a traffic intensity a = p0 = S −1 = 1 − a = λ γ = 1/3. 2 . 3 (b) the probability that the robber’s teller is busy. P (X(t) ≥ 1) = 1 − p0 = 1 . 3 (c) the average number of robbers in the bank. Because this is an M/M/1 system X(t) ∼ Modified Geometric(p = 1 − a). This means that X(t) = Y − 1 for Y ∼ Geometric(p = 1 − a). Therefore, E[X] = E[Y ] − 1 = 1 a −1= . 1−a 1−a In this case, L = E[X(t)] = a 1/3 = = 0.5. 1−a 1 − 1/3 5 (d) the average time a robber must queue for service (a robbery). The average time a robber must queue for service is Wq , and Wq = W − Ws . By Little’s Law, the average time in the system is L . λ W = From the problem description, the average service time is Ws = 1 1 = . γ 6 So, the average time in the queue is Wq L 1 − = λ γ 0.25 − 1/6 = 5/60 hours = 5 minutes. = W − Ws = = (e) the average time required for a robbery (queuing time plus service time) Little’s Lay −→ W = L = 0.25 hours = 15 minutes. λ 6