IME 254 Engineering Probability and Statistics I Chapter 2: Probability Section 2.6 Jointly Distributed Random Variables Bivariate Probability Distribution for Discrete Random Variables Consider two random variables X and Y that concurrently map simple events in the sample space to real numbers Sample space Random variable X −∞, ∞ Random variable Y −∞, ∞ Bivariate (joint) probability distribution, denoted by p(x,y), is a table, graph or formula that specifies the probability of intersection of any two numerical events X=x and Y=y Bivariate Probability Distribution for Discrete Random Variables (cont.) Recall from Section 2.3: P(A ∩ B) = P(A)P(B|A) = P(B)P(A|B) If we assign two numbers to each point in the sample space– one corresponding to the value of discrete random variable X, and the second to discrete random variable Y– then specific values of X and Y represent two numerical events. The probability of the intersection of these two events is as follows: P(X ∩ Y) = P(X = x, Y = y) = p(x,y) = pX(x)pY(y|x) = pY(y)pX(x|y) Bivariate Probability Distribution for Discrete Random Variables (cont..) Bivariate probability distributions should satisfy two conditions ΰ· π(π₯, π¦) = 1 ∀(π₯,π¦) 0 ≤ π π₯, π¦ ≤ 1 We can obtain the probability distribution of each individual random variable from the bivariate distribution using ππ π₯ = ΰ· π(π₯, π¦) π¦ ππ π¦ = ΰ· π(π₯, π¦) π₯ Which are so-called marginal probability distributions Example 1: Bivariate Probability Distribution Let X represent the number of weekly credit card purchases a person makes, and Y the number of credit cards a person owns. Suppose the bivariate table for the two variables looks as follows: p(x,y) Y: # of cards 1 2 3 0 0.08 0.08 0.04 X: purchases/week 1 2 3 0.1 0.02 0.1 0.05 0.05 0.22 0.04 0.18 0.04 a) Find the marginal probability distribution of X b) What is the probability that a randomly selected person owns two credit cards and makes two or fewer purchases per week? Example 1: Solution a) Marginal probability distributions of X and Y are added as a row and column to the joint probability distribution table respectively p(x,y) Y: # of cards P(X=x) X: purchases/week P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 2 0.08 0.05 0.22 0.05 3 0.04 0.04 0.04 0.18 Example 1: Solution (part a) a) Marginal probability distributions of X and Y are added as a row and column to the joint probability distribution table respectively p(x,y) Y: # of cards P(X=x) X: purchases/week P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 Example 1: Bivariate Probability Distribution (cont.) p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 b) What is the probability that a randomly selected person owns two credit cards and makes two or fewer purchases per week? Example 1: Solution (part b) p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 b) What is the probability that a randomly selected person owns two credit cards and makes two or fewer purchases per week? Example 1: Solution (part b cont.) p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 b) What is the probability that a randomly selected person owns two credit cards and makes two or fewer purchases per week? This is the probability of the intersection of two events π ≤ 2 and π = 2, which can be calculated as π π ≤ 2, π = 2 = π 0,2 + π 1,2 + π 2,2 = 0.35 Conditional Probability Distribution for Discrete Random Variables The probability of numerical event X=x given that the event Y=y has occurred is called the conditional probability of X=x given Y=y. Conditional probability distribution is a table, graph or formula that gives conditional probabilities of X=x given Y=y for all possible values of random variable X Conditional probability distribution of random variable X given Y=y is calculated as π π₯, π¦ π π₯, π¦ π π₯π¦ = = ππ(π¦) π(π¦) Example 2: Conditional Probability Distribution p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 a. Using bivariate probability distribution, find the conditional probability distribution of r.v. Y given that X=1 b. What is the probability that a randomly selected person makes no purchases per week given that he/she owns two credit cards? Example 3: Bivariate Probability Distribution Consider the experiment of tossing a pair of dice. Let X be the outcome (i.e., the number of dots appearing face up) on the first die, and let Y be the outcome on the second die. a. Find the joint probability distribution p(x,y). b. Find the marginal probability distributions pX(x) and pY(y). c. Find the conditional probability distributions pX(x|y) and pY(y|x). Example 3: Solution Conditional probability distributions pX(x|y) and pY(y|x): Y: Die 2 1 2 3 4 5 6 P(X = x) 1 2 X: Die 1 3 4 5 6 P(Y = y) X=1 P(X=x|Y=1) 1 X=2 X=3 X=4 X=5 X=6 Bivariate Probability Distribution for Continuous Random Variables The conditional density functions for continuous random variables X and Y are π π₯,π¦ f1(x|y) = π (π¦) 2 π π₯,π¦ f2(y|x) = π (π₯) 1 Expected Value of Functions of Two Random Variables Let h(X,Y) be a function of discrete random variables X and Y. Then the expected value (mean) of h(X,Y) is defined to be πβ(π,π) = ΰ· ΰ· β π₯, π¦ π(π₯, π¦) π¦ Also, π₯ πΈ ππ = σπ₯ σπ¦ π₯π¦π(π₯, π¦) Expected Value of Functions of Two Random Variables (cont.) Let c be a constant. Expected value of c is πΈ(π) = π Let c be a constant, and let g(X,Y) be a function of the random variables X and Y. The expected value of cg(X,Y) is πΈ[ππ π, π ] = ππΈ[π π, π ] Expected Value of Functions of Two Random Variables (cont..) Let gX(X,Y), gY(X,Y), … , gk(X,Y) be k functions of the random variables X and Y. The expected value of the sum of these functions is πΈ ππ π, π + ππ π, π + β― + ππ π, π + = πΈ ππ π, π + πΈ ππ π, π + β― + πΈ[ππ π, π ] Independence Let X and Y be discrete random variables with joint probability distribution p(x,y) and marginal probability distributions pX(x) and pY(y). Then X and Y are said to be independent if and only if π π₯, π¦ = ππ (π₯)ππ (π¦) for all pairs of values of x and y If X and Y are independent random variables, then πΈ ππ = πΈ π πΈ(π) Correlation Between Random Variables Suppose X and Y are random variables, and we collect a sample of n pairs (x,y) from them and plot those n data points A positive correlation is when Y increases as X increase A negative correlation is when Y decreases as X increases Linear Correlation When investigating whether X and Y are positively or negatively correlated • we tend to think of it in terms of linear relationships • we do not consider any nonlinear relationship In the two cases below there is not any linear correlation between X and Y; however, unlike case (c), case (d) shows a strong nonlinear relationship Correlation Against All Odds: “Correlation” Directed by Graham Chedd, fl. 1973; presented by Pardis Sabeti, 1975-; produced by Maggie Villiger, fl. 1999 and Graham Chedd, fl. 1973, Chedd-Angier Production Company, Inc., in Against all odds: Inside Statistics, Unit 12 (District of Columbia: Annenberg Learner, 2014), 11 mins Measuring Linear Correlation Using Sample Covariance Sample covariance is the cross product of deviations from the mean for each data point (x,y) in the sample σππ=1 π₯π − πΰ΄€ π¦π − πΰ΄€ πΆππ£ π, π = π−1 Measuring Linear Correlation Using Sample Covariance (cont.) Sample covariance is the cross product of deviations from the mean for each data point (x,y) in the sample σππ=1 π₯π − πΰ΄€ π¦π − πΰ΄€ πΆππ£ π, π = π−1 A positive (negative) sample covariance implies a positive (negative) correlation Population Covariance For two r.v. X and Y the covariance is defined as πΆππ£ π, π = πΈ π − ππ π − ππ = πΈ ππ − ππ ππ If o πͺππ πΏ, π = π, then X and Y are linearly uncorrelated o πͺππ πΏ, π > π, then X and Y are positively correlated o πͺππ πΏ, π < π, then X and Y are negatively correlated If X and Y are independent random variables then πͺππ πΏ, π =0 Example 4: Covariance of X and Y a) Find the expected value for X, and interpret the result b) Find the expected value for Y, and interpret the result c) Calculate E[XY] d) Calculate Covariance p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 Example 4: Covariance of X and Y - a a) Find the expected value for X, and interpret the result p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 πΈ π = ππ₯ = ΰ· π₯π(π₯) πππ π₯ Example 4: Covariance of X and Y - b b) Find the expected value for Y, and interpret the result p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 πΈ π = ππ¦ = ΰ· π¦π(π¦) πππ π¦ Example 4: Covariance of X and Y - c c) Calculate E[XY] p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 πΈ ππ = ΰ· ΰ· π₯π¦π(π₯, π¦) πππ π₯ πππ π¦ Example 4: Covariance of X and Y - d d) Calculate Covariance p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 πΆππ£ π, π = πΈ ππ − ππ ππ Coefficient of Correlation • To adjust covariance for units of measurement of X and Y we define coefficient of correlation between X and Y as πΆππ£ π, π π(π, π) = ππ ππ where σX and σY are standard deviations of r.v. X and Y Coefficient of Correlation (cont.) • To adjust covariance for units of measurement of X and Y we define coefficient of correlation between X and Y as πΆππ£ π, π π(π, π) = ππ ππ where σX and σY are standard deviations of r.v. X and Y • It can be shown that −1 < π < 1 • π is used to quantify the strength of linear correlation between X and Y Example: Linear Correlation The local ice cream shop keeps track of how much ice cream they sell versus the temperature on that day. The table below shows the data for the last 12 days: Temperature °C Ice Cream Sales 14.2° $215 16.4° $325 11.9° $185 15.2° $332 18.5° $406 22.1° $522 19.4° $412 25.1° $614 23.4° $544 18.1° $421 22.6° $445 17.2° $408 • Sample Covariance: 484.1 • Correlation Coefficient: 0.96 (a strong positive correlation) Example 5: Coefficient of Correlation p(x,y) X (purchases) Y (# of cards) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 P(X=x) Calculate the coefficient of correlation: σππ=1 π₯π − πΰ΄€ π¦π − πΰ΄€ πΆππ£ π, π = π−1 πͺππ πΏ, π π(πΏ, π) = ππΏ ππ 2 2 ππ₯ = ΰ· π₯ − ππ₯ π(π₯) πππ π₯ ππ₯ = 1.66 ππ¦ = 2 2 ππ¦ 2 = ΰ· π¦ − ππ¦ π(π¦) πππ π¦ Example 5: Coefficient of Correlation Calculate ππ₯ p(x,y) X (purchases) Y (# of cards) P(X=x) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 ππ₯ 2 = ΰ· π₯ − ππ₯ 2 π(π₯) πππ π₯ (ππ₯ = 1.66) Example 5: Coefficient of Correlation Calculate ππ¦ p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 2 ππ¦ 2 = ΰ· π¦ − ππ¦ π(π¦) πππ π¦ (ππ¦ = 2) Example 5: Coefficient of Correlation – Calculate π(π, π) p(x,y) Y (# of cards) P(X=x) X (purchases) P(Y=y) 0 1 2 3 1 0.08 0.1 0.1 0.02 0.3 2 0.08 0.05 0.22 0.05 0.4 3 0.04 0.04 0.04 0.18 0.3 0.2 0.19 0.36 0.25 1 πΆππ£ π, π π π, π = ππ ππ