3 8 functions of random variables 3 7 3 9 3 11 multiple
play

3.8 Functions of random variables 3.7, 3.9, 3.11 Multiple random - PowerPoint PPT Presentation

3.8 Functions of random variables 3.7, 3.9, 3.11 Multiple random variables (discrete) Prof. Tesler Math 186 Winter 2019 Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 1 / 39 3.8 One random variable as a


  1. 3.8 Functions of random variables 3.7, 3.9, 3.11 Multiple random variables (discrete) Prof. Tesler Math 186 Winter 2019 Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 1 / 39

  2. 3.8 One random variable as a function of another random variable (Discrete) Let X = roll of a biased die, Y = 10 X + 2 , and Z = ( X − 3 ) 2 . z = ( x − 3 ) 2 p X ( x ) y = 10 x + 2 p Y ( y ) p Z ( z ) x 1 q 1 12 q 1 4 2 q 2 22 q 2 1 p Z ( 0 ) = q 3 3 q 3 32 q 3 0 p Z ( 1 ) = q 2 + q 4 4 q 4 42 q 4 1 p Z ( 4 ) = q 1 + q 5 5 q 5 52 4 q 5 p Z ( 9 ) = q 6 6 62 9 q 6 q 6 For W = g ( X ) , the pdf p W ( w ) is the sum of p X ( x ) over all possible inverses x = g − 1 ( w ) , or p W ( w ) = 0 if there are no inverses: � p W ( w ) = p X ( x ) x : g ( x )= w Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 2 / 39

  3. Function of a Discrete Random Variable Let X = roll of a biased die, Y = 10 X + 2 , and Z = ( X − 3 ) 2 . z = ( x − 3 ) 2 p X ( x ) y = 10 x + 2 p Y ( y ) p Z ( z ) x 1 q 1 12 q 1 4 2 q 2 22 q 2 1 p Z ( 0 ) = q 3 3 q 3 32 q 3 0 p Z ( 1 ) = q 2 + q 4 4 q 4 42 q 4 1 p Z ( 4 ) = q 1 + q 5 5 q 5 52 q 5 4 p Z ( 9 ) = q 6 6 q 6 62 q 6 9 For Y = aX + b with a � 0 , the unique inverse is X = Y − b a , so � y − b � p Y ( y ) = p X a Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 3 / 39

  4. Function of a Discrete Random Variable Let Y = X 2 . Inverses of y = x 2 are  ± √ y if y > 0 ;   x = if y = 0 ; 0   none if y < 0 .  P ( X = √ y ) + P ( X = − √ y ) if y > 0 ;   P ( Y = y ) = P ( X 2 = y ) = P ( X = 0 ) if y = 0 ;   if y < 0 . 0 Use pdf notation to express pdf of Y in terms of pdf of X :  p X ( √ y ) + p X (− √ y ) if y > 0 ;   p Y ( y ) = p X ( 0 ) if y = 0 ;   if y < 0 . 0 Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 4 / 39

  5. Function of a Continuous Random Variable Let U be uniform on the real interval [ 1 , 7 ] , so � if 1 � u � 7 (in real numbers); 1 / 6 f U ( u ) = otherwise 0 Let V = 2 U . This is uniform on [ 2 , 14 ] , so � 1 / 12 if 2 � v � 14 (in real numbers); f V ( v ) = otherwise 0 Even though there’s just one inverse for each value, the probabilities of corresponding values are different! Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 5 / 39

  6. Continuous Random Variables: Computing f Y ( y ) from f X ( x ) when Y = g ( X ) Procedure Let Y = g ( X ) . Compute F X ( x ) . Compute F Y ( y ) = P ( Y � y ) = P ( g ( X ) � y ) = · · · Details depend on the function. Typically it is expressed in terms of F X ( x ) at various values of x (the ones where g ( x ) = y ). Compute f Y ( y ) = d dyF Y ( y ) . Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 6 / 39

  7. Example with one-to-one function f X ( x ) = 8 e − 8 x Let for x � 0 . It’s a valid pdf since it’s � 0 and the total probability is 1: � ∞ � ∞ 8 e − 8 x dx = 8 e − 8 x ∞ � � f X ( x ) dx = � − 8 � − ∞ 0 x = 0 = −( e − ∞ − e 0 ) = −( 0 − 1 ) = 1 The CDF for x � 0 is � x � x x 8 e − 8 t dt = 8 e − 8 t � � F X ( x ) = f X ( t ) dt = � − 8 � − ∞ 0 t = 0 = −( e − 8 x − e 0 ) = 1 − e − 8 x while for x < 0 , the CDF is F X ( x ) = 0 . Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 7 / 39

  8. Example with one-to-one function � � 8 e − 8 x 1 − e − 8 x if x � 0 ; if x � 0 ; pdf: f X ( x ) = cdf: F X ( x ) = if x < 0 if x < 0 0 0 We’ll compute the pdf of Y = 10 X + 2 . First, we convert the two cases x � 0 and x < 0 to y . Note x � 0 gives 10 x � 0 , so 10 x + 2 � 2 , so y � 2 . Similarly, x < 0 gives y < 2 . Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 8 / 39

  9. Example with one-to-one function � � 8 e − 8 x 1 − e − 8 x if x � 0 ; if x � 0 ; f X ( x ) = F X ( x ) = Y = 10 X + 2 if x < 0 if x < 0 0 0 Wrong Way: f Y ( y ) = f X ( g − 1 ( y )) as in the discrete case Try f Y ( y ) = f X (( y − 2 ) / 10 ) : � 8 e − 8 ( y − 2 ) / 10 if y � 2 ; f Y ( y ) = if y < 2 . 0 Compute the total probability: � ∞ � ∞ ∞ 8 e − 8 ( y − 2 ) / 10 dy = 8 e − 8 ( y − 2 ) / 10 � � f Y ( y ) dy = � − 8 / 10 � − ∞ 2 y = 2 = − 10 ( e − ∞ − e 0 ) = − 10 ( 0 − 1 ) = 10 � 1 The total probability is not 1, so this is not a valid pdf. Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 9 / 39

  10. Example with one-to-one function � � 8 e − 8 x 1 − e − 8 x if x � 0 ; if x � 0 ; f X ( x ) = F X ( x ) = Y = 10 X + 2 if x < 0 if x < 0 0 0 Right way: Compute CDF F Y ( y ) and differentiate f Y ( y ) = F Y ′ ( y ) Compute CDF F Y ( y ) : F Y ( y ) = P ( Y � y ) = P ( 10 X + 2 � y ) � 1 − e − 8 ( y − 2 ) / 10 � � � y − 2 � X � y − 2 if y � 2 ; = P = F X = 10 10 if y < 2 . 0 Differentiate to get PDF f Y ( y ) : � 10 e − 8 ( y − 2 ) / 10 8 if y > 2 ; ′ ( y ) = f Y ( y ) = F Y if y < 2 . 0 Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 10 / 39

  11. Y = aX + b in general where a , b are constants and a � 0 In general, for a continuous random variable X , the pdfs of X and Y = aX + b are related by � y − b � f Y ( y ) = 1 | a | f X a Whereas if X is a discrete random variable, then � y − b � p Y ( y ) = p X a Note the scaling factor 1 / | a | for the continuous case, but not for the discrete case. Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 11 / 39

  12. Example with general function Y = g ( X ) Compute CDF and PDF of Y = X 2 where X is a continuous R.V. When y � 0 , F Y ( y ) = P ( Y � y ) = P ( X 2 � y ) = 0 f Y ( y ) = d dyF Y ( y ) = d dy 0 = 0 When y > 0 , = P ( Y � y ) = P ( X 2 � y ) F Y ( y ) = P (− √ y � X � √ y ) = F X ( √ y ) − F X (− √ y ) = d F X ( √ y ) − F X (− √ y ) � � f Y ( y ) dy ′ ( √ y ) ′ (− √ y ) � � � � 1 1 = F X − F X − 2 √ y 2 √ y = f X ( √ y ) + f X (− √ y ) 2 √ y Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 12 / 39

  13. 3.7, 3.9, 3.11 Multiple random variables (discrete) Multinomial distribution Consider a biased 6-sided die where q i is the probability of rolling i for i = 1 , 2 , . . . , 6 . (6 sides is an example, it could be any # sides.) Each q i is between 0 and 1 , and q 1 + · · · + q 6 = 1 . The probability of a sequence of independent rolls is 6 � P ( 1131326 ) = q 1 q 1 q 3 q 1 q 3 q 2 q 6 = q 13 q 2 q 32 q 6 = q i # i ’s i = 1 Roll the die n times ( n = 0 , 1 , 2 , 3 , . . .). Let X 1 be the number of 1’s, X 2 be the number of 2’s, etc. p X 1 , X 2 ,..., X 6 ( k 1 , k 2 , . . . , k 6 ) = P ( X 1 = k 1 , X 2 = k 2 , . . . , X 6 = k 6 )  q 1 k 1 q 2 k 2 . . . q 6 k 6 n � �  k 1 , k 2 ,..., k 6   if k 1 , . . . , k 6 are integers � 0 adding up to n ; =    otherwise. 0 Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 13 / 39

  14. Genetics example Consider a TtRR × TtRr cross of pea plants: Genotype Prob. Punnett Square 1 / 8 TTRR TR ( 1 / 2 ) tR ( 1 / 2 ) 2 / 8 = 1 / 4 TtRR TR ( 1 / 4 ) TTRR ( 1 / 8 ) TtRR ( 1 / 8 ) 1 / 8 TTRr Tr ( 1 / 4 ) TTRr ( 1 / 8 ) TtRr ( 1 / 8 ) 2 / 8 = 1 / 4 TtRr tR ( 1 / 4 ) TtRR ( 1 / 8 ) ttRR ( 1 / 8 ) 1 / 8 ttRR tr ( 1 / 4 ) TtRr ( 1 / 8 ) ttRr ( 1 / 8 ) 1 / 8 ttRr Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 14 / 39

  15. Genetics example If there are 27 offspring, what is the probability that 9 offspring have genotype TTRR, 2 have genotype TtRR, 3 have genotype TTRr, 5 have genotype TtRr, 7 have genotype ttRR, and 1 has genotype ttRr? Use the multinomial distribution: Genotype Probability Frequency 1/8 TTRR 9 1/4 TtRR 2 1/8 TTRr 3 1/4 TtRr 5 1/8 ttRR 7 1/8 ttRr 1 Total 1 27 � 9 � 1 � 2 � 1 � 3 � 1 � 5 � 1 � 7 � 1 � 1 � 1 27 ! ≈ 2 . 19 · 10 − 7 P = 9 ! 2 ! 3 ! 5 ! 7 ! 1 ! 8 4 8 4 8 8 Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 15 / 39

  16. Genetics example If there are 25 offspring, what is the probability that 9 offspring have genotype TTRR, 2 have genotype TtRR, 3 have genotype TTRr, 5 have genotype TtRr, 7 have genotype ttRR, and 1 has genotype ttRr? P = 0 because the numbers 9 , 2 , 3 , 5 , 7 , 1 do not add up to 25 . Prof. Tesler Ch. 3. Functions of random vars. (discrete) Math 186 / Winter 2019 16 / 39

Recommend


More recommend