ENGG 2040 C Probability Models and Applications Spring
ENGG 2040 C: Probability Models and Applications Spring 2014 6. Jointly Distributed Random Variables Andrej Bogdanov
Cards There is a box with 4 cards: 1 2 3 4 You draw two cards without replacement. What is the p. m. f. of the sum of the face values?
Cards Probability model S = ordered pairs of cards, equally likely outcomes X = face value on first card Y = face value on second card We want the p. m. f. of X + Y P(X + Y = 4) = 1/6. = P(X = 1, Y = 3) + P(X = 2, Y = 2) + P(X = 3, Y = 1) 1/12 0 1/12
Joint distribution function In general P(X + Y = z) = ∑(x, y): x + y = z P(X = x, Y = y) to calculate P(X + Y = z) we need to know f(x, y) = P(X = x, Y = y) for every pair of values x, y. This is the joint p. m. f. of X and Y.
Cards joint p. m. f. of X and Y: X Y 1 2 3 4 1 0 1/12 2 2 3 4 1/12 0 1/12 5 1/12 3 4 5 1/12 0 6 1/12 4 3 4 5 6 1/12 7 1/12 5 6 2 0 3 1/6 4 1/6 5 1/3 6 1/6 7 1/6 8 0 7 8 0 p. m. f. of X + Y
Question for you There is a box with 4 cards: 1 2 3 4 You draw two cards without replacement. What is the p. m. f. of the larger face value? What if you draw the cards with replacement?
X 1 2 3 4 1 0 1/12 1/4 2 1/12 0 1/12 1/4 3 1/12 0 1/12 1/4 4 1/12 0 1/4 1/4 1/4 1 Y P(X = x) = ∑y P(X = x, Y = y) P(Y = y) = ∑x P(X = x, Y = y) Marginal probabilities
Red and blue balls You have 3 red balls and 2 blue balls. Draw 2 balls at random. Let X be the number of blue balls drawn. Replace the 2 balls and draw one ball. Let Y be the number of blue balls drawn this time. X Y 0 1 2 0 9/50 18/50 3/5 1 6/50 12/50 2/5 3/10 6/10 1/10 Y X
Independent random variables Let X and Y be discrete random variables. X and Y are independent if P(X = x, Y = y) = P(X = x) P(Y = y) for all possible values of x and y.
Example Alice tosses 3 coins and so does Bob. What is the probability they get the same number of heads? Probability model Let A / B be Alice’s / Bob’s number of heads Each of A and B is Binomial(3, ½) A and B are independent We want to know P(A = B)
Example Solution 1 A 0 1 2 3 B 0 1/64 3/64 1/8 1 3/64 9/64 3/8 2 3/64 9/64 3/8 3 1/64 3/64 1/8 1/8 3/8 1/8 B A P(A = B) = 20/64 = 31. 25%
Example Solution 2 P(A = B) = ∑h P(A = h, B = h) = ∑h P(A = h) P(B = h) = ∑h (C(3, h) 1/8) = 1/64 (C(3, 0)2 + C(3, 1)2 + C(3, 2)2 + C(3, 3)2) = 20/64 = 31. 25%
Independent Poisson Let X be Poisson(m) and Y be Poisson(n). If X and Y are independent, what is the p. m. f. of X + Y? Intuition 0 X is the number of blue raindrops in 1 sec Y is the number of red raindrops in 1 sec X + Y is the total number of raindrops E[X + Y] = E[X] + E[Y] = m + n 1
Independent Poisson The p. m. f. of X + Y is P(X + Y = z) = ∑(x, y): x + y = z P(X = x, Y = y) = ∑(x, y): x + y = z P(X = x) P(Y = y) = ∑(x, y): x + y = z (e-m mx/x!) (e-n ny/y!) = e-(m+n) ∑(x, y): x + y = z (mxny)/(x!y!) The p. m. f. of a Poisson(m + n) r. v. Z is P(Z = z) = = (e-(m+n)/z!) (m + n)z = (e-(m+n)/z!) ∑zx = 0 z!/x!(z-x)! mxnz - x . . . so X + Y is a Poisson(m + n) random variable
Barista jam On average a barista sells 2 espressos at $15 each and 3 lattes at $30 each per hour. (a) What is the probability she sells fewer than five coffees in the next hour? (b) What is her expected hourly income? (c) What is the probability her income falls short of expectation in the next hour?
Barista jam Probability model X/Y is number of espressos/lattes sold in next hour X is Poisson(2), Y is Poisson(3); X, Y independent Solution (a) X + Y is Poisson(5) so P(X + Y < 5)= ∑z 4 = 0 e-5 5 z/z! ≈ 0. 440
Barista jam (b) hourly income (in dollars) is 15 X + 30 Y E[15 X + 30 Y] = 15 E[X] + 30 E[Y] = 15× 2 + 30× 3 = 120 -120 120 z/z! (c) P(15 X + 30 Y < = ∑z 119 e ≈ 0. 488 =0 120) wrong!
Barista jam (c) P(15 X + 30 Y < 120) = ∑ (x, y): 15 x + 30 y < 120 P(X = x, Y = y) = ∑(x, y): 15 x + 30 y < 120 P(X = x) P(Y = y) = ∑(x, y): 15 x + 30 y < 120 (e-2 2 x/x!) (e-3 3 y/y!). . . using the program 14 L 09. py ≈ 0. 480
Expectation E[X, Y] doesn’t make sense, so we look at E[g(X, Y)] for example E[X + Y], E[min(X, Y)] There are two ways to calculate it: Method 1. First obtain the p. m. f. f. Z of Z = g(X, Y) Then calculate E[Z] = ∑z z f. Z(z) Method 2. Calculate directly using the formula E[g(X, Y)] = ∑x, y g(x, y) f. XY(x, y)
Method 1: Example A B 0 1 2 3 0 1/64 3/64 1 0 2 min(A, B) 3 0 0 0 3/64 1/64 0 15/64 0 1 1 1 9/64 3/64 1 33/64 0 1 2 2 9/64 3/64 2 15/64 1 2 3 3/64 1/64 3 1/64 0 E[min(A, B)] = 0⋅15/64 + 1⋅33/64 + 2⋅15/64 + 3⋅1/64 = 33/32
Method 2: Example A B 0 1 2 3 0 1/64 3/64 1 2 3 0 0 3/64 1/64 0 1 1 1 9/64 3/64 0 1 2 2 9/64 3/64 0 1 2 3 3/64 1/64 E[min(A, B)] = 0⋅1/64 + 0⋅3/64 +. . . + 3⋅1/64 = 33/32
the cheat sheet X, Y discrete joint p. m. f. f. XY(x, y) = P(X = x, Y = y) Probability of an event (determined by X, Y) P(A) = ∑(x, y) in A f. XY (x, y) Derived random variables f. Z(z) = ∑(x, y): g(x, y) = z f. XY(x, y) Z = g(X, Y) Marginal p. m. f. ’s f. X(x) = ∑y f. XY(x, y) Independence f. XY(x, y) = f. X(x) f. Y(y) for all x, y Expectation of Z = g(X, Y) E[Z] = ∑x, y g(x, y) f. XY(x, y)
Continuous random variables A pair of continuous random variables X, Y can be specified either by their joint c. d. f. FXY(x, y) = P(X ≤ x, Y ≤ y) or by their joint p. d. f. f. XY(x, y) = ∂ ∂ FXY(x, y) ∂x ∂y P(x < X ≤ x + e, y < Y ≤ y + d) = e, lim d→ 0 ed
An example Rain drops at a rate of 1 drop/sec. Let X and Y be the arrival times of the first and second raindrop. X F(x, y) = P(X ≤ x, Y ≤ y) Y f(x, y) = ∂ ∂ F(x, y) ∂x ∂y
Continuous marginals Given the joint c. d. f FXY(x, y) = P(X ≤ x, Y ≤ y), we can calculate the marginal c. d. f. s: FX(x) = P(X ≤ x) = lim FXY (x, y) y→∞ FY(y) = P(Y ≤ y) = lim FXY (x, y) P(X ≤ x) x→∞ Exponential(1)
the continuous cheat sheet X, Y continuous with joint p. d. f. f. XY(x, y) Probability of an event (determined by X, Y) P(A) = ∫∫A f. XY (x, y) dxdy Derived random variables f. Z(z) = ∫∫(x, y): g(x, y) = z f. XY(x, y) dxdy Z = g(X, Y) ∞ ∫-∞ Marginal p. d. f. ’s f. X(x) = Independence f. XY(x, y) = f. X(x) f. Y(y) for all x, y f. XY(x, y) dy Expectation of Z = g(X, Y) E[Z] = ∫∫ g(x, y) f. XY(x, y) dxdy
Independent uniform random variables Let X, Y be independent Uniform(0, 1). f. XY(x, y) = f. X(x) f. Y(y) = f. X(x) = 1 if 0 < x < 1 0 if not f. Y(y) = 1 if 0 < y < 1 0 if not 1 if 0 < x, y < 1 0 if not f. XY(x, y)
Meeting time Alice and Bob arrive in Shatin between 12 and 1 pm. How likely arrive within 15 minutes of one another? Probability model Arrival times X, Y are independent Uniform(0, 1) Event A: |X – Y| ≤ ¼ P(A) = ∫∫A f. XY (x, y) dxdy = ∫∫A 1 dxdy = area(A) in [0, 1]2
Meeting time 1 Event A: |X – Y| ≤ ¼ P(A) = area(A) y y = 1 – (3/4)2 = x + ¼ y = x – ¼ = 7/16 0 0 x 1
Buffon’s needle A needle of length l is randomly dropped on a ruled sheet. What is the probability that the needle hits one of the lines?
Buffon’s needle The lines are 1 unit apart X is the distance from midpoint to nearest line X Q 1 Q is angle with horizontal Probability model X is Uniform(0, ½) X, Q are independent Q is Uniform(0, p)
Buffon’s needle The p. d. f. is l/2 X Q f. XQ(x, q) = f. X(x) f. Q(q) = 2/p 1 for 0 < x < ½, 0 < q < p ½ The event H = “needle hits line” happens when X < (l/2) sin. Q l/2 x 0 H 0 q p
Buffon’s needle If l ≤ 1 (short needle) then (l/2) sinq is always ≤ ½: P(H) = ∫∫B f. XQ(x, q) dxdq= P(H) = = = p (l/2) sinq ∫ 0 2/p p ∫ 0 (l /p) sin d p (l /p) ∫ 0 sin d = 2 l /p. p (l/2)sinq ∫ 0 dxdq q q 2/p dxdq
Many random variables: discrete case Random variables X 1, X 2, …, Xk are specified by their joint p. m. f P(X 1 = x 1, X 2 = x 2, …, Xk = xk). We can calculate marginal p. m. f. ’s, e. g. P(X 1 = x 1, X 3 = x 3) = ∑x 2 P(X 1 = x 1, X 2 = x 2, X 3 = x 3) P(X 3 = x 3) = ∑x 1, x 2 P(X 1 = x 1, X 2 = x 2, X 3 = x 3) and so on.
Independence for many random variables Discrete X 1, X 2, …, Xk are independent if P(X 1 = x 1, X 2 = x 2, …, Xk = xk) = P(X 1 = x 1) P(X 2 = x 2) … P(Xk = xk) for all possible values x 1, …, xk. For continuous, we look at p. d. f. ’s instead of p. m. f. ’s
Dice Three dice are tossed. What is the probability that their face values are non-decreasing? Solution Let X, Y, Z be face values of first, second, third die X, Y, Z independent with p. m. f. p(1) = … = p(6) = 1/6 We want the probability of the event X ≤ Y ≤ Z
Many-sided dice Now you toss an “infinite-sided die” 3 times. What is the probability the values are increasing?
- Slides: 38