STAT 211 1

Handout 5 (Chapter 5): Joint Probability Distributions and Random Samples

Some more rules of expected value and variance to use in this handout.

(i) For constants a, b, and c and the random variables X and Y, E(aX  bY  c) = aE(X)  bE(Y)  c

(ii) For constants a, b and c and the random variables X1 and X2, 2 2 Var(a X1  b X2  c) = a Var(X1)+ b Var(X2)  2 abCov(X1, X2)

(iii) For constants a1 to an and the random variables X1 to Xn,  n  n n n Var a X  a 2 Var(X )  2  a  a Cov(X , X )  i i   i i  i j i j  i1  i1 i1 j1 i j By using the following examples, the joint probability mass function for two discrete random variables and their properties, their marginal probability mass functions, the case for independent and dependent variables, their conditional distributions, expected value, variance, covariance, and correlation will be demonstrated. All the formulas and explanations will be introduced in class and you already have them in chapter 5 of the textbook.

Example 1: Quality audit records are kept on numbers of major and minor failures of circuit packs during-in of large electronic switching devices. They indicate that for a device of this type, the random variables X (the number of major failures) and Y (the number of minor failures) can be described at least approximately by the accompanying joint distribution. 0 1 2 Total x y 0 0.15 0.05 0.01 0.21 1 0.10 0.10 0.04 0.24 2 0.10 0.14 0.04 0.28 3 0.10 0.13 0.04 0.27 Total 0.45 0.42 0.13 1

a. Is the table above a valid joint pmf for X and Y? Yes

b. Find the marginal probability mass functions for X and Y. x 0 1 2 otherwise p(x) 0.45 0.42 0.13 0

y 0 1 2 3 otherwise p(y) 0.21 0.24 0.28 0.27 0

c. Are X and Y independent? No

d. Find the expected value and the variance of X. E(X)=0.68 E(X2)= 0.94 Var(X)=0.4776

e. Find the expected value and the variance of Y. E(Y)=1.61 E(Y2)= 3.79 Var(Y)=1.1979 STAT 211 2

f. Find the Cov(X,Y) and Corr(X,Y). E(XY)=1.25 Cov(X,Y)=0.1552 Corr(X,Y)=0.2052

g. Find the conditional probability function for Y given that X=0 that is there are no circuit pack failures. y 0 1 2 3 otherwise P(Y=y | X=0) 0.3333 0.2222 0.2222 0.2222 0

h. What is the expected number of minor failures given that there were no major failures? E(Y | X=0) =1.3333

i. Suppose that demerits are assigned to devices of this type according to the formula D=2X+Y. Find the marginal probability mass function for D. d 0 1 2 3 4 5 6 7 otherwise P(D=d) 0.15 0.10 0.15 0.20 0.15 0.17 0.04 0.04 0 d=0 only when X=0,Y=0 then P(d=0)=P(X=0,Y=0) d=3 only when X=0,Y=3 or X=1,Y=1 then P(d=3)=P(X=0,Y=3)+P(X=1,Y=1)

j. Suppose that demerits are assigned to devices of this type according to the formula D=2X+Y. Find the expected value and the variance of D. E(D)=2.97 E(D2)=12.55 Var(D)=3.7291

k. Suppose that demerits are assigned to devices of this type according to the formula U=Min(X,Y). Find the mean value and the variance of U. u 0 1 2 otherwise P(U=u) 0.51 0.41 0.08 0

u=0 only when X=0,Y=0 or X=0,Y=1 or X=0,Y=2 or X=0,Y=3 or X=1,Y=0 or X=2,Y=0 then

P(U=0)=P(X=0,Y=0)+P(X=0,Y=1)+P(X=0,Y=2)+P(X=0,Y=3)+P(X=1,Y=0)+P(X=2,Y=0)

E(U)=0.57 E(U2)=0.73 Var(U)=0.4051

By using the following example, the joint probability density function for two continuous random variables and their properties, their marginal probability density functions, the case for independent and dependent variables, their conditional distributions, expected value, variance, covariance, and correlation will be demonstrated.

Example 2: Suppose that a pair of random variables, X and Y have the same joint probability density  x  y if 0  x  1 and 0  y  1 f (x, y)    0 otherwise a. Find the marginal probability density functions for X and Y.

 x  0.5 0  x  1  y  0.5 0  y  1 g(x)   and h(y)    0 otherwise  0 otherwise STAT 211 3

b. Are X and Y independent? No

c. Find the expected value and variance of X. E(X)=7/12 E(X2)= 5/12 Var(X)=11/144

d. Find the expected value and variance of Y. E(Y)=7/12 E(Y2)= 5/12 Var(Y)=11/144

e. Find the conditional probability density function of x given y=0.6.  x  y  if 0  x  1 and 0  y  1 10x 6 f (x | y)   y  0.5 . When y=0.6, f(x|y)=  for 0

f. Find the conditional probability density function of y given x=0.4.  x  y  if 0  x  1 and 0  y  1 10y 4 f (y | x)   x  0.5 . When x=0.4, f(y|x)=  for 0

g. Calculate E(X|Y=0.6)? (=19/33)

h. Find the Cov(X,Y) and Corr(X,Y). E(XY)=1/3 Cov(X,Y)=-1/144 Corr(X,Y)=-1/11

Example 3: Suppose that a pair of random variables, X and Y have the same joint probability density  x(1 y) if 0  x  2 and 0  y  1 f (x, y)    0 otherwise a. Find the marginal probability density functions for X and Y.

 x / 2 0  x  2 2(1 y) 0  y  1 g(x)   and h(y)    0 otherwise  0 otherwise

b. Are X and Y independent? Yes

c. Find the expected value and variance of X. E(X)=4/3 E(X2)= 2 Var(X)=0.2222

d. Find the expected value and variance of Y. E(Y)=1/3 E(Y2)= 1/6 Var(Y)=0.0556

e. Find the conditional probability density function of x given y=0.6.  x / 2 if 0  x  2 and 0  y  1 f (x | y)   . When y=0.6, f(x|y)=x/2 for 0x2  0 otherwise STAT 211 4

f. Find the conditional probability density function of y given x=0.4. 2(1 y) if 0  x  2 and 0  y  1 f (y | x)   . When x=0.4, f(y|x)=2(1-y) for 0y1  0 otherwise

g. What is E(X|Y=0.6)? 4/3

h. Find the Cov(X,Y) and Corr(X,Y). E(XY)=4/9 Cov(X,Y)=0 Corr(X,Y)=0

Random Sample: The random variables X1, X2, ….,Xn are said to form a random sample of size n if (i) The Xi's are independent random variables. (ii) Every Xi's has the same probability distribution. _ The sampling distribution of x and the distribution of a linear combination of variables: 2 Let X1,X2,….,Xn be a random sample of size n with the mean E(X)= and variance Var(X)=  . _ _   _ (A)The expected value of X is  _  E X    and the variance of X is x    _   2  Var X   2 / n _   . x  

If Xi's are normally distributed then _ 2  X is also normally distributed with the mean  and the variance  / n .  x   Z  has a standard normal distribution with the mean 0 and the variance 1.  / n

n n (B)The expected value of X is   E X i   n and the variance of X is  i  X i   i i1 i1 2 2   Var X i   n .  X i 

If Xi's are normally distributed then n 2   X i is also normally distributed with the mean n and the variance n . i1 X  n  Z   i has a standard normal distribution with the mean 0 and the variance 1  n

(C)If h(x) is a linear combination of Xi’s then the mean of h(x) is  h(x)  Eh(x) and the 2 variance of h(x) is  h(x)  Varh(x) .

If Xi's are normally distributed then  h(x) is also normally distributed with the mean E(h(x)) and the variance Var(h(x)). h(x)  E(h(x))  Z  has a standard normal distribution with the mean 0 and the variance 1 Var(h(x)

Example 4 (Exercise 5.42): A company maintains 3 offices in a certain region, each staffed by two employees. Information concerning yearly salaries (1000’s of dollars) is as follows: STAT 211 5

Office 1 1 2 2 3 3 Employee 1 2 3 4 5 6 Salary 19.7 23.6 20.2 23.6 15.8 19.7 (a) Suppose two of these employees are randomly selected from among the six (without _ replacement). Determine the sampling distribution of the sample mean salary X . S={(1,2),(1,3),(1,4),(1,5),(1,6),(2,1),(2,3),(2,4),(2,5),(2,6),(3,1),(3,2),(3,4),(3,5),(3,6), (4,1),(4,2), (4,3),(4,5),(4,6),(5,1),(5,2),(5,3),(5,4),(5,6),(6,1),(6,2),(6,3),(6,4),(6,5)}. There are 30 outcomes. _ x 21.65 when (1,2),(2,1),(1,4),(4,1),(2,6),(6,2),(4,6),(6,4) with 8 outcomes 19.95 when (1,3),(3,1),(3,6),(6,3) with 4 outcomes 17.75 when (1,5),(5,1),(5,6),(6,5) with 4 outcomes 19.70 when (1,6),(6,1),(4,5),(5,4),(2,5),(5,2) with 6 outcomes 21.90 when (2,3),(3,2),(3,4),(4,3) with 4 outcomes 23.60 when (2,4),(4,2) with 2 outcomes 18.0 when (3,5),(5,3) with 2 outcomes _ x : 17.75 18 19.7 19.95 21.65 21.90 23.60 otherwise _ P(x) : 4/30 2/30 6/30 4/30 8/30 4/30 2/30 0 _ _ _ E( x )=  x p( x) =613/30=20.43

(b) Suppose one of the three offices is randomly selected. Determine the sampling distribution _ of the sample mean salary X . S={(1,2),(2,1),(3,4),(4,3),(5,6),(6,5)}. There are 6 outcomes _ x 21.65 when (1,2),(2,1) with probability 1/3 21.90 when (3,4),(4,3) with probability 1/3 17.75 when (5,6),(6,5) with probability 1/3 _ E( x )=61.3/3=20.43 Population mean = (19.7+23.6+20.2+23.6+15.8+19.7)/6=20.43

Additional:The sampling distribution of the range of salaries for part (b) is range: 3.4 3.9 p(range) : 2/6 4/6 E(range)=  range  p(range) =3.7333 where Population range is 23.6-15.8=7.8

Example 5 (Exercise 5.60): Five automobiles of the same type are to be driven on a 300-mile th trip. Let Xi be the observed fuel efficiency (mpg) for the i car. First two cars are economy brand and Xi’s are distributed N(20,4), i=1,2 Last three cars are name brand and Xi’s are distributed N(21,3.5), i=3,4,5 All five are independent. Y is a measure of the difference in efficiency between economy gas and name brand gas.  X  X X  X  X  20  20 21 21 21 E(Y)= E 1 2  3 4 5  =  =20-21=-1  2 3  2 3 STAT 211 6

 X  X X  X  X  4  4 3.5  3.5  3.5 Var(Y)= Var 1 2  3 4 5  =  =2+1.1667=3.1667  2 3  4 9

P(Y0)=P(Z0.56)=0.2877

P(-1Y1)=P(Y1)-P(Y<-1)=P(Z1.12)-P(Z<0)=0.8665-0.5=0.3665

Example 6 (Exercise 5.66) : If two loads are applied to a cantilever beam, the bending moment at 0 due to loads is a1X1+a2X2 where X1

2 2 (a) E(X1)=2, E(X2)=4, Var(X1)=0.5 and Var(X2)=1 a1=5 and a2 =10 then let Y=5X1+10X2 : the bending moment E(5X1+10X2)= 5E(X1)+10E(X2)=5(2)+10(4)=50 2 2 Var(5X1+10X2)= 25Var(X1)+100Var(X2)=25(0.5 )+100(1 )=106.25 Then the standard deviation is 10.308

(b) Y=5X1+10X2 ~ N(50 , 106.25)  75  E(Y)   75  50  P Z    P Z  P(Y>75)=     =P(Z>2.43)=0.0075  Var(Y)   10.3078 

(c) Let independent A1 and A2 be random variables which are independent from Xi‘s. E(A1X1+A2X2)= E(A1)E(X1)+ E(A2)E(X2)=5(2)+10(4)=50

2 (d) Var(A1X1+A2X2) = E[{(A1X1+A2X2)-E(A1X1+A2X2)} ] 2 = E[{(A1X1+A2X2)-50} ] 2 2 2 2 E(A1 )E(X 1 )  E(A2 )E(X 2 )  2500  2(50)E(A1 )E(X 1 ) =    2(50)E(A2 )E(X 2 )  2E(A1 )E(X 1 )E(A2 )E(X 2 )  = 25.25(4.25)+100.25(17)+2500-100(5)(2)100(10)(4)+2(5)(2)(10)(4) = 111.5625

(e) If Corr(X1,X2)=0.5 then Cov(X1,X2)=[Corr(X1,X2)] Var(X 1 ) Var(X 2 ) =(0.5)(0.5)(1)=0.25

It means X1 and X2 are not independent then Var(5X1+10X2) = 25Var(X1)+100Var(X2)+2(5)(10) Cov(X1,X2) = 106.25+100(0.25) = 131.25

Example 7 (Exercise 5.69): Three different roads feed into a particular freeway entrance. Number of cars coming from each road onto the freeway is a random variable. Road 1 Road 2 Road 3 Expected value 800 1000 600 Standard deviation 16 25 18 (a) What is the expected total number of cars entering the freeway at this point during the period? E(R1+R2+R3)= E(R1)+E(R2)+E(R3)=2400

(b) What is the variance of the total number of cars entering the freeway at this point during the period? assuming independence, Var(R1+R2+R3)= Var(R1)+Var(R2)+Var(R3)=1205 STAT 211 7

(c) If Cov(R1,R2)=80, Cov(R1,R3)=90, Cov(R2,R3)=100 then E(R1+R2+R3)=2400 and Var(R1+R2+R3)= Var(R1)+Var(R2)+Var(R3)+2 Cov(R1,R2)+2 Cov(R1,R3)+2 Cov(R2,R3) =1205+2(80)+2(90)+2(100)=1745 which gives the standard deviation as 41.77

Central Limit Theorem: Let X1, X2,….,Xn be a random sample from a distribution with mean  and variance 2. Then if n is sufficiently large (n>30), _ 2 2  has approximately a normal distribution with mean  _   and variance  _   / n X X X n X   n   i has approximately a normal distribution with mean  xi and variance i1 2 2   n .  xi  The larger the value of n, the better the approximation.

Example 8: Based on data from the National Health Survey, assume that men’s weights are distributed with a mean, 172 lb and a standard deviation 29 lb.

(a) If one man is randomly selected from a normal distribution, find the probability that his weight is less than 167 pounds.

(b) If random sample of 64 men are selected from an unknown distribution, find the probability that they have a mean weight between 170 and 175 lb.

Example 9: Let X1,X2,…,X100 denote the actual net weights of randomly selected 50-lb bags of fertilizer. If the expected weight of each bag is 50 and the variance is 1, (a) What is the probability that the average weight of 100 bags will be between 49.75 and 50.25? _ 2 2 The average weight of 100 bags is .  _  50 and  _   / n  1/100  0.01 X X X  _   49.75  50 50.25  50  P49.75  X  50.25  P  z    P(-2.5≤z≤2.5)   byCLT  0.01 0.01  =0.9938-0.0062=0.9876

(b) What is the probability that the total weight of 100 bags will be between 4950 and 5000? n 2 2 The total weight of 100 bags is X .  x  n =5000 and   n =100  i  i  xi i1

 4950  5000 5000  5000  P4950   X i  5000  P  z    P(-5≤z≤0)=0.5-0=0.5 byCLT  100 100 