Probability and Statistics ì for Computer Science “It’s straigh,orward to link a number to the outcome of an experiment. The result is a Random variable .” ---Prof. Forsythe Random variable is a funcDon, it is not the same as in X = X+1 Credit: wikipedia Hongye Liu, Teaching Assistant Prof, CS361, UIUC, 9.15.2020
Which is larger? hands of 6 The probability of drawing no pairs have 5- cards that . ( ng replacement ) 0 . 5 ② > 0.5 larger B larger is Or is A O . . 52 × 48484 × 40 × 36 g- permit Int III ' : *
Pc An B ) Last time P ( Al B) = ¥ Conditional probability joint prob . * Product of rule * Bayes rule peal BE PCA ) * Independence = PCA > pl B) PLAN B)
Objectives Interface variable Random btw North . CS moi and the * Definition * probability distribution CDF PDF , * Conditional probability distr : .
Random numbers � Amount of money on a bet � Age at reDrement of a populaDon � Rate of vehicles passing by the toll � Body temperature of a puppy in its pet clinic � Level of the intensity of pain in a toothache network in node a a Degree of ' ~ -
⇐ field Random variable as vectors ( A ) Brain imaging of Human emoDons CB ) A) Moral conflict B) MulD-task ( C ) C) Rest ily ter ' 774 t , A. McDonald et al. NeuroImage doi: 10.1016/ j.neuroimage.2016.10.048
Random variables variable A maps random Numbers , outcomes so eo all CK ) ( W ) Bernoulli function ! ! it's a = panicky w is tail XXXX is head w I Xcw )
Random variables � The values of a random variable can be either discrete , con5nuous or mixed .
Discrete Random variables � The range of a discrete random variable is a countable set of real numbers. '
Random Variable Example � Number of pairs in a hand of 5 cards w = = ? O � Let a single outcome be the hand of 5 cards � Each outcome maps to values in the set of numbers {0, 1, 2} 7 , O , 2
Random Variable Example � Number of pairs in a hand of 6 cards � Let a single outcome be the hand of 6 cards � What is the range of values of this random variable? I , 3 O 2 , ,
Q: Random Variable � If we roll a 3-sided fair die, and define random variable U, such that side Ucw ) =/ § w is i side z is w side 3 is w the range of what is X = U2 take can A. {-1, 0, 1} B. {0, 1}
Three important facts of Random variables � Random variables have probability func5ons � Random variables can be condi5oned on events or other random variables � Random variables have averages
Random variables have probability functions � Let X be a random variable s . t . Xcw ) = kg } { w Gr � The set of outcomes is an event with probability 3 ) • =p ( { w it . P ( X = x ) X is the random variable is any unique instance that X takes on Ko
Probability Distribution � is called the probability P ( X = x ) distribuDon for all possible x � is also denoted as or p ( x ) P ( X = x ) P ( x ) � for all values that X can P ( X = x ) ≥ 0 take, and is 0 everywhere else � The sum of the probability distribuDon is 1 � P ( x ) = 1 x
Examples of Probability Distributions side : ) I Yw ! ucwutf ? xcws -4 ! ? , side 3 . XCW )=UZ apex - N ) - pc × =x ) His . ÷i 73 . . l O - xcwkfgqt.r.am ; pcX=K ) =z . . - A 0 I 2
-1 2C= 0 =/ ÷ Ye ! xcws -4 ! z P' * " pika , a- =/ otherwise o x I 0 " " " YE 2C=0 side : vowel ? . . ÷÷¥*i÷ " " . otherwise 0 2C -
Cumulative distribution � is called the cumulaDve P ( X ≤ x ) oooo distribuDon funcDon of X � is also denoted as f ( x ) P ( X ≤ x ) � is a non-decreasing P ( X ≤ x ) funcDon of x
Probability distribution and cumulative distribution � Give the random variable X , � 1 outcome of ω is head X ( ω ) = 0 outcome of ω is tail p ( x ) f ( x ) P ( X = x ) P ( X ≤ x ) - 1 9¥ 1/2 1/2 0 1 1 0 X X
value ? Q What the is . is rolled A biased - sided die once four . be the is defined Random variable X to down - face value . I - K ) =/ 2 , 3 , 4 2C =L , p ( X - ' ° all others op ( Xs 47 → a o . 2 C) A) o . I . 6 ° -3 D) 0 B) I -
Functions of Random Variables - f y site ; V - 3 x# " - XHX ut - - - X - -
Q. Are these random variables the same? ' awry ; Ya : xcwrt : Ii : RV Bernoulli . } ' ' = O • x ~ o o V = Xt Y - j = 2X in - l , l O - ' ° I the same and V A) U are Not BM u and the V are same . ⇐ to , if v → { o , I , -3
Function of random variables: die example Roll 4-sided fair die Y 4 twice. 3 Define these random 2 variables: 1 X X, the values of 1 st roll 1 2 3 4 Y, the values of 2 nd roll 4 × 4=16 Sum S = X + Y Size of Sample Space = ? Difference D = X - Y
Random variable: die example Roll 4-sided fair die Y 4 twice. 3 = 'T P ( X = 1) 2 = 'T 1 P ( Y ≤ 2) X 1 2 3 4 O P ( S = 7) P ( D ≤ − 1) Size of Sample Space x = 16
Random variable: die example S = X + Y D = X-Y ¥ 0 Y Y 4 4 7 8 6 5 -1 0 -3 -2 3 3 0 1 -2 -1 6 5 4 7 2 2 2 -1 0 1 5 6 4 3 1 3 1 2 1 0 4 3 5 2 X X 1 2 3 4 1 2 3 4 plw . s.t.sc#E7 ) = I - I P ( D ≤ − 1) P ( S = 7) - -
Probability distribution of the sum of two random variables � Give the random variable S in the 4- sided die, whose range is {2,3,4,5,6,7,8}, probability distribuDon of S. 446 p ( s ) 46 = 16 , 1/16 TG S 5 6 8 2 3 4 7
Probability distribution of the difference of two random variables � Give the random variable D = X-Y , what is the probability distribu<on of D ? 1/16 - l Z -3 l L - z 0
Conditional Probability � The probability of A given B P ( A | B ) = P ( A ∩ B ) - P ( B ) P ( B ) � = 0 The “Size” analogy � P ( x | y ) = 1 Credit: Prof. Jeremy Orloff & Jonathan Bloom x
Conditional probability distribution of random variables � The condiDonal probability distribuDon of X given Y is P ( x | y ) = P ( x, y ) P ( y ) � = 0 P ( y ) - x n ' F- y ) Pc x . y l = P C X - p Cy ) = pc 4- y , CK l y ) = P C X ⇒ 4 7- y ) p
Get the marginal from joint distri. � We can recover the individual probability distribuDons from the joint probability distribuDon pix .gs=pcY1x)p ① � P ( x ) = P ( x, y ) Epoxy , y = -2 pcY/x > pox ) y - Y A re � P ( y ) = P ( x, y ) = pix ) -2g x = pie ,
Joint probabilities sum to 1 � The sum of the joint probability distribuDon r � � P ( x, y ) = 1 - a y x
Joint Probability Example � Tossing a coin twice, we define random variable X and Y for each toss . � 1 outcome of ω is head X ( ω ) = 0 outcome of ω is tail � 1 outcome of ω is head Y ( ω ) = 0 outcome of ω is tail
Joint probability distribution example . I 1 X P ( y ) P ( x, y ) 0 1 it 0 Y E ¥4 DEE P ( x )
Joint Probability Example Now we define Sum S = X + Y, Difference D = X – Y. S takes on values {0,1,2} and D takes on values {-1, 0, 1} � 1 outcome of ω is head X ( ω ) = 0 outcome of ω is tail � 1 outcome of ω is head Y ( ω ) = 0 outcome of ω is tail
Joint Probability Example 2 nd toss D=d f- S D P(s, d) S pcs-s.r-dj-I.cz Y =1 0 2 =pc 1 st toss t tutte as X =1 1 1 y Y =0 I 1 -1 Y =1 4 X =0 ° 0 0 I Y =0 4 pcanbt-PCBIAIPCAI-pcalbgpcB.JP , "% ' Suppose coin is fair, and the tosses are independent
Joint probability distribution example D P ( s, d ) -1 0 1 P ( s ) ¥ 0 0¥ 0 0 S 1 I ¥ 0 ¥ - 2 ¥ 0 0 ¥ pest -2 pass P ( d ) . city D
Independence of random variables � Random variable X and Y are independent if P ( x, y ) = P ( x ) P ( y ) for all x and y * � In the previous coin toss example � Are X and Y independent? � Are S and D independent? for all S , d Pcs , D) =p is > PCD ) .
Joint probability distribution example 1 X P ( y ) P ( x, y ) 0 1 1 1 0 Y 4 4 2 1 1 1 1 4 4 2 1 1 P ( x ) 2 2
Joint probability distribution example D P ( s, d ) -1 0 1 P ( s ) 0 1 1 0 0 S 4 4 O o 1 1 1 0 1 2 4 4 1 2 1 0 0 4 4 Cleo 5=1 , P ( d ) C pcs=f , d -03=0 1 1 1 2 4 4 pcS= ' > Pide )=¥ are Not D S . irdept .
Joint probability distribution example D P ( s, d ) -1 0 1 P ( s ) 0 1 1 0 0 S 4 4 1 1 1 0 1 2 4 4 1 2 1 0 0 4 4 P ( d ) 1 1 1 2 4 4 P ( S = 1 , D = 0) � = P ( S = 1) P ( D = 0)
Conditional probability distribution example P ( s | d ) = P ( s, d ) P ( d ) -1 0 1 D 1 0 0 0 S 2 1 0 1 1 1 2 0 0 2
Bayes rule for random variable � Bayes rule for events generalizes to random variables P ( A | B ) = P ( B | A ) P ( A ) P ( B ) P ( x | y ) = P ( y | x ) P ( x ) P ( y ) P ( y | x ) P ( x ) Total Probability = � x P ( y | x ) P ( x )
Conditional probability distribution example P ( s | d ) = P ( s, d ) D -1 0 1 P ( d ) 1 0 0 0 S 2 1 0 1 1 1 2 0 0 2 1 × 1 P ( D = − 1 | S = 1) = P ( S = 1 | D = − 1) P ( D = − 1) = 4 1 P ( S = 1) 2
Assignments � Chapter 4 of the textbook � Next Dme: More random variable, ExpectaDons, Variance
Recommend
More recommend