Stat 330 (Spring 2015): Homework 10 Due: April 10, 2015 Show all of your work, and please staple your assignment if you use more than one sheet. Write your name, the course number and the section on every sheet. Show all work for earning partial credit. Problems marked with * will be graded and one additional randomly chosen problem will be graded. 1. * Guests of a luxury hotel form a line to use one of 5 terminals located in an internet café in the lobby area. They arrive at the café at the rate of 10 per hour and spend an average of 20 minutes at a terminal and then leave. Assuming that both times are distributed exponentially, answer the following questions. Show work. (a) Draw a state diagram representing the number of customers using the café. (b) How many terminals can go down and the system remain stable for servicing customers? (c) What is the probability that there aren’t any customers in the café? (d) What is the probability that all terminals are busy? (e) On the average, how long does a customer stay in the café? (f) Determine the number of people in the café on the average. Answer: Model this situation using an M/M/5 queue with arrival rate λ = 10 per hour and service rate µ = 3 per hour: (a) State Diagram is: 10 10 1 0 3 2 3 6 6 5 4 12 9 10 10 10 10 15 o o o o o 15 (b) The stability condition is that ρ = λ/(cµ) < 1. In this case λ = 10 and µ = 3 giving c > 3.33 implying that the smallest c possible for obtaining equilibrium is c = 4. Thus only one terminal can go down for the system to remain stable. (c) a = λ/µ = 10/3 and ρ = λ/(cµ) = 10/(5 · 3) = 2/3 Need P (X(t) = 0) = p0 . First calculate S: S = 4 X ak k=0 k! + a5 1 5! 1 − ρ = 10 100 1 1000 1 10000 1 100000 1 + · + · + · + · ·3 3 9 2 27 6 81 24 243 120 1 + 3.33333 + 5.55555 + 6.17284 + 5.14403 + 10.28807 = 31.4938 = 1+ Thus p0 = 1/S = 0.03175 (d) Here is the situation where Erlang’s C formula C(c, a) is used to calculate probability that all servers (here the terminals) are busy: P (X(t) ≥ c) = C(c, a) = 1 ac 1 c! 1 − ρ 100000 1 = 0.03175 · · ·3 243 120 = 0.3266 = p0 Stat 330 (Spring 2015): Homework 10 Due: April 10, 2015 (e) Need to first find Lq and then Wq = Lq /λ. This will give us the total waiting time W = Ws + Wq where we know Ws = 1/µ = 1/3 hours. Lq = = ρ C(c, a) 1−ρ 2 · 0.3266 = 0.6532 Thus Wq = Lq /λ = 0.6532/10 = 0.06532 hours or 3.92 minutes. Thus W = Ws + Wq = .33333 + 0.06532 = 0.39865 hours or 23.92 minutes. (f) The overall average number of people in the system L = W λ = 0.39865 · 10 = 3.98 ≈ 4 persons. 2. (Baron’s book) 8.1 Answer: before <- c(56, 47, 49, 37, 38, 60, 50, 43, 43, 59, 50, 56, 54, 58) after <- c(53, 21, 32, 49, 45, 38, 44, 33, 32, 43, 53, 46, 36, 48, 39, 35, 37, 36, 39, 45) # (a) # To do this in R, you need to load the following package. As an # alternative, this problem could easily be done by hand. Uncomment the # following line to install the required package. # install.packages('aplpack') library("aplpack", lib.loc = "~/R/win-library/3.1") Warning: package ’aplpack’ was built under R version 3.1.3 Loading required package: tcltk stem.leaf.backback(before, after) __________________________________ 1 | 2: represents 12, leaf unit: 1 before after __________________________________ | 2* |1 1 | 2. | | 3* |223 4 2 87| 3. |5667899 11 4 33| 4* |34 (2) 6 97| 4. |55689 7 (3) 400| 5* |33 2 5 9866| 5. | 1 0| 6* | __________________________________ n: 14 20 __________________________________ # (b) quantile(before) #5 number summary for before 2 Stat 330 (Spring 2015): Homework 10 0% 37 25% 44 50% 50 quantile(after) Due: April 10, 2015 75% 100% 56 60 #5 number summary for after 0% 25% 50% 75% 100% 21.00 35.75 39.00 45.25 53.00 20 30 40 50 60 boxplot(before, after) 1 2 (c) There appears to be fewer blocked intrusions after the change. 3. (Baron’s book) 8.2 Answer: n.user <13.3, 21.9, 13.4, c(17.2, 22.1, 18.5, 17.2, 18.6, 14.8, 21.7, 15.8, 16.3, 22.8, 24.1, 16.2, 17.5, 19, 23.9, 14.8, 22.2, 21.7, 20.7, 13.5, 15.8, 13.1, 16.1, 23.9, 19.3, 12, 19.9, 19.4, 15.4, 16.7, 19.5, 16.2, 16.9, 17.1, 20.2, 19.8, 17.7, 19.7, 18.7, 17.6, 15.9, 15.2, 17.1, 15, 18.8, 21.6, 11.9) # (a) m <- mean(n.user) m 3 Stat 330 (Spring 2015): Homework 10 Due: April 10, 2015 [1] 17.954 v <- var(n.user) v [1] 9.968249 s <- sd(n.user) s [1] 3.157253 # (b) s/sqrt(50) [1] 0.4465031 # (c) quantile(n.user) 0% 25% 50% 75% 100% 11.900 15.825 17.550 19.875 24.100 boxplot(n.user) 4 Stat 330 (Spring 2015): Homework 10 12 14 16 18 20 22 24 Due: April 10, 2015 # (d) iqr <- quantile(n.user, p = 0.75) - quantile(n.user, p = 0.25) iqr 75% 4.05 lb <- quantile(n.user, p = 0.25) - iqr lb #Observations lower than this are considered outliers 25% 11.775 ub <- quantile(n.user, p = 0.75) + iqr ub #Observations higher than this are considered outliers 75% 23.925 # 24.1 is an outlier # (e) hist(n.user) 5 Stat 330 (Spring 2015): Homework 10 Due: April 10, 2015 8 6 0 2 4 Frequency 10 12 Histogram of n.user 10 15 20 25 n.user # yes, the histogram is unimodal and symetric, so it appears that the number # of users follows a normal distribution. 4. A sample of 3 observations of waiting time to access an internet server is x1 = 0.4, x2 = 0.7, x3 = 0.9 seconds. It is believed that the waiting time has the continuous distribution ( θtθ−1 , 0 < t < 1 f (t) = 0, otherwise (a) Find an estimate of the parameter θ using the method of moments. (b) Find the maximum likelihood estimate of θ. Answer: (a) Using method of moments, Z µ1 = E(X) = Z 1 xf (x)dx = xθxθ−1 dx = 0 R and m1 = x̄ so that θ̂ = x̄ ⇐⇒ θ̂ = θ̂ + 1 For the given data, x̄ = (0.4 + 0.7 + 0.9)/3 = 2/3 so that θ̂ = 6 x̄ . 1 − x̄ 2/3 =2 1 − 2/3 θ θ+1 Stat 330 (Spring 2015): Homework 10 Due: April 10, 2015 5. (Baron’s book) 9.1 Answer: The let X be a random variable with P (X = 3) = θ and P (X = 7) = 1 − θ with θ ∈ (0, 1). Then E[X] = 3θ + 7(1 − θ) = 7 − 4θ. (a) For the method of moments (MoM) estimator, set the first population moment to the first sample moment: x = 7 − 4θ. Thus the Mom estimator is θ̂M oM = (7 − x)/4 = 5/8. 7