probability and statistics
play

Probability*and*Statistics* ! for*Computer*Science** - PowerPoint PPT Presentation

Probability*and*Statistics* ! for*Computer*Science** Who!discovered!this?! ! n 1 + 1 e = lim n n Jacob Bernoulli Credit:!wikipedia! Hongye!Liu,!Teaching!Assistant!Prof,!CS361,!UIUC,!02.20.2020! Last*time*


  1. Probability*and*Statistics* � ! for*Computer*Science** Who!discovered!this?! ! � n � 1 + 1 e = lim n n →∞ Jacob Bernoulli Credit:!wikipedia! Hongye!Liu,!Teaching!Assistant!Prof,!CS361,!UIUC,!02.20.2020!

  2. Last*time* � Random!Variable!! � Review&with&ques,ons& � The&weak&law&of&large&numbers&

  3. Announcement* * please content start review course to l Mar . 5) Midterm l for Review your mistakes Uws for *

  4. last Experiment in lecture Received ' 16 results teams * corrected needs be One ere * 4.5 mean is * Sample random expt value for each Expected . 5 is

  5. Content* � Con$nuous'Random'Variable'' � Important!known!discrete! probability!distribuMons! !

  6. Example*of*a*continuous*random* variable* � The!spinner! Pco = 351=0 θ! θ ∈ (0 , 2 π ] 0! � The!sample!space!for!all!outcomes!is! not!countable! !

  7. the probability of * What is in a constant p LO = Oo ) ? do is UT ] ( o , * ⇐ the probability of what is It E o so E Oo ) ? p l - 2K

  8. Probability*density*function*(pdf)* � For!a!conMnuous!random!variable! X, !the! probability!that! X = x !is!essenMally!zero!for!all! (or!most)! x ,!so!we!can’t!define!! P ( X = x ) Ittner � Instead,!we!define!the! probability'density' func$on !(pdf)!over!an!infinitesimally!small! do - a nd interval! dx, p ( x ) dx = P ( X ∈ [ x, x + dx ]) - o � b � For a < b -1730 p ( x ) dx = P ( X ∈ [ a, b ]) ! p ex ) Z o - a

  9. Properties*of*the*probability*density* function** � !!!!!!!!! resembles' the!probability!funcMon! p ( x ) of!discrete!random!variables!in!that! � !!!!!!!!!!!!!!!!!!!!!!!!!!for!all! x p ( x ) ≥ 0 - � The!probability!of! X !taking!all!possible! = values!is!1.! � ∞ p ( x ) dx = 1 −∞ !

  10. Properties*of**the*probability*density* function** � !!!!!!!!! differs !from!the!probability! p ( x ) distribuMon!funcMon!for!a!discrete! random!variable!in!that! � !!!!!!!!!!!!is!not!the!probability!that! X !=! x !! p ( x ) � !!!!!!!!!!!!can!exceed!1! p ( x ) - J ! pexldx El # pixel ! !

  11. Probability*density*function:*spinner* � Suppose!the!spinner!has!equal!chance! stopping!at!any!posiMon.!What’s!the!pdf!of!the! - angle!θ!of!the!spin!posiMon?!!!!!!!!!! in f c! � if θ ∈ (0 , 2 π ] c p ( θ ) = 11 l l l - I 0 otherwise 0! 2π! θ � !For!this!funcMon!to!be!a!pdf,! - qigong Then!! � ∞ ⇒ c = 1 i p ( θ ) d θ = 1 2 π −∞

  12. Probability*density*function:*spinner* � What!the!probability!that!the!spin!angle!θ!is! within![!!!!!!!!!!!]?!!!!!!!!!! 12 , π π 7 O O pix C- cabs ) = Jb pcxsdx a ¥dx= S = 12

  13. Probability*density*function:*spinner* � What!the!probability!that!the!spin!angle!θ!is! within![!!!!!!!!!!!]?!!!!!!!!!! 12 , π π 7 p ( θ ) - 1 2 π % E 's 0! 2π! θ

  14. Probability*density*function:*spinner* � What!the!probability!that!the!spin!angle!θ!is! within![!!!!!!!!!!!]?!!!!!!!!!! 12 , π π 7 π � P ( π 12 ≤ θ ≤ π 7 7 ) = p ( θ ) d θ π 12 p ( θ ) 1 2 π 0! 2π! θ

  15. Probability*density*function:*spinner* � What!the!probability!that!the!spin!angle!θ!is! within![!!!!!!!!!!!]?!!!!!!!!!! 12 , π π 7 π π � P ( π 12 ≤ θ ≤ π � 1 5 7 7 7 ) = p ( θ ) d θ = 2 π d θ = 168 π π 12 12 - - - p ( θ ) 1 2 π 0! 2π! θ

  16. Q:*Probability*density*function:*spinner* � What!is!the!constant! c !given!the!spin!angle!θ! has!the!following!pdf?! p ( θ ) A.!1! B.!1/π! C.!2/π! c' D.!4/π! E.!1/2π! π! 0! 2π! θ

  17. Q:*Probability*density*function:*spinner* � What!is!the!constant! c !given!the!spin!angle!θ! has!the!following!pdf?! p ( θ ) A.!1! B.!1/π! x! C.!2/π! c' D.!4/π! E.!1/2π! π! 0! 2π! θ

  18. Expectation*of*continuous* variables* � Expected!value!of!a!conMnuous!random! variable! X weight& � ∞ E [ X ] = xp ( x ) dx x! - −∞ - � Expected!value!of!funcMon!of!conMnuous! random!variable! Y = f ( X ) - � ∞ ! E [ Y ] = E [ f ( X )] = f ( x ) p ( x ) dx T ype - −∞

  19. Probability*density*function:*spinner* � Given!the!probability!density!of!the!spin!angle!θ!!!!!!!!!!! � 1 if θ ∈ (0 , 2 π ] p ( θ ) = 2 π 0 otherwise - � The!expected!value!of!spin!angle!is!! . # do � ∞ o E [ θ ] = θ p ( θ ) d θ = EYE → " −∞ - T - =

  20. Probability*density*function:*spinner* � Given!the!probability!density!of!the!spin!angle!θ!!!!!!!!!!! � 1 if θ ∈ (0 , 2 π ] p ( θ ) = 2 π 0 otherwise � The!expected!value!of!spin!angle!is!! � 2 π � ∞ θ 1 2 π d θ E [ θ ] = θ p ( θ ) d θ = 0 −∞

  21. Probability*density*function:*spinner* � Given!the!probability!density!of!the!spin!angle!θ!!!!!!!!!!! � 1 if θ ∈ (0 , 2 π ] p ( θ ) = 2 π 0 otherwise � The!expected!value!of!spin!angle!is!! � 2 π � ∞ θ 1 2 π d θ = π E [ θ ] = θ p ( θ ) d θ = 0 −∞

  22. Properties*of*expectation*of* continuous*random*variables* � The!linearity!of!expected!value!is!true!for! conMnuous!random!variables. � � - � And!the!other!properMes!that!we!derived! for!variance!and!covariance!also!hold!for! - conMnuous!random!variable! - Given X , 'T indpt it x Y are RV varlx -41=051 × 7-1 vary ) !

  23. Q.* � Suppose!a!conMnuous!variable!has!pdf! � 2(1 − x ) x ∈ [0 , 1] p ( x ) = 0 otherwise ! J ! X pixldx X -2 × 2 ) Ix What!is!E[X]?!! = - ¥ If T = x' ✓ A.!1/2 !!!B.!1/3 !!!!C.!1/4!!! !! = ' -3 = 's D.!1 !!!!! !!!E.!2/3 ! � ∞ E [ X ] = xp ( x ) dx ! −∞

  24. Q.* � Suppose!a!conMnuous!variable!has!pdf! � 2(1 − x ) x ∈ [0 , 1] p ( x ) = 0 otherwise ! What!is!E[X]?!! A.!1/2 !!!B.!1/3 !!!!C.!1/4!!! !! x! D.!1 !!!!! !!!E.!2/3 ! !

  25. Variance*of*a*continuous*variable* pcx ) = f I ] X C- co , l otherwise 0 E[ ex - text ) varCx7= ? - - Efx ) -_ ? I pcx ) → ' I'm EE ± = Sj ex - IT . ' DX , I - 12

  26. CDE of the spin ? What is the variable random for continues CDF the same way defined is ⑧ pcxsdx Pex , - → p Cx ) = { It . ] e - it if x o , others =/ g.sc#.ax=Eaxei l - I :P " X > 2T , , pcxex ) - "

  27. Content* � ConMnuous!Random!Variable!! � Important'known'discrete' probability'distribu$ons' S I s !

  28. The*usefulness*of*probability* distributions* � Many!common!processes!generate!data! with!probability!distribuMons!that!belong!to! families!with!known!properMes! mr � Even!if!the!data!are!not!distributed! according!to!a!known!probability! distribuMon,!it!is!someMmes!useful!in! pracMce!to!approximate!with!known! distribuMon.!

  29. The*classic*discrete*distributions** distribution Discrete uniform * distribution Bernoulli * distribution }p?eIYouee Geometric : * Binomial distribution * distribution Multinomial *

  30. Discrete*uniform*distribution* � A!discrete!random!variable! X !is!uniform!if!it! takes!k!different!values!and!! ! ! !! P ( X = x i ) = 1 For!all! x i !that! X !can!take! k p ex , ein X � For!example:! . � Rolling!a!fair!kdsided!die! . " "÷¥ : = � Tossing!a!fair!coin!(k=2)! ±

  31. Discrete*uniform*distribution* � ExpectaMon!of!a!discrete!random!variable! X !that!! takes!k!different!values!uniformly! ECx7= Exipcx , k E [ X ] = 1 E � x i = k K = ¥ I ti i =1 - it � Variance!of!a!uniformly!distributed!random! variable! X !.! k var [ X ] = 1 � ( x i − E [ X ]) 2 k i =1 -

  32. Bernoulli*distribution* � A!random!variable! X !is! Bernoulli !if!it!takes!on!two! values!0!and!1!such!that! → H X =/ P PCX )=f ! → T , - p x=o others O !! IX. pix , E [ X ] = p - p -104 ) =L - p - =p var [ X ] = p (1 − p ) varCx7=ECX4 - ETx7=EEpcx , - p " ~ =p - p Jacob!Bernoulli!(1654d1705)! =p a - p ) Credit:!wikipedia!

  33. Bernoulli*distribution* � Examples! → H p T 1- � Tossing!a!biased!(or!fair)!coin! l - p - s -1 � Making!a!free!throw! pix-65.to � Rolling!a!sixdsided!die!and!checking!if!it!shows!6! - � Any'indicator'func$on !of!a!random!variable! ex ) =/ ! PCA ) =p A occurs torx Thea , - otherwise

  34. Geometric*distribution* � A!discrete!random!variable! X !is!geometric!if!! ie . p is the prob . of head P ( X = k ) = (1 − p ) k − 1 p k ≥ 1 a - PIK 's - ' p H,!TH,!TTH,!TTTH,!TTTTH,!TTTTTH,…! . - - - - k of them � Expected!value!and!variance ! E [ X ] = 1 var [ X ] = 1 − p & → p 2 p Ek CI - p ) KIELTY - ETXJ E- Cx ) -

  35. Geometric*distribution* P ( X = k ) = (1 − p ) k − 1 p k ≥ 1 P=!0.2! P=!0.5! Credit:!Prof.!Grinstead!

  36. Geometric*distribution* � Examples:! � How!many!rolls!of!a!sixdsided!die!will!it!take!to! see!the!first!6?! � How!many!Bernoulli!trials!must!be!done!before! the!first!1?! � How!many!experiments!needed!to!have!the!first! success?! � Plays!an!important!role!in!the! theory'of'queues'

  37. Derivation*of*geometric*expected* value* ∞ � k (1 − p ) k − 1 p E [ X ] = petit k =1 ∞ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! � k (1 − p ) k − 1 ! = p ! !!!!!!!!!!!!!! k =1 ! ∞ p k (1 − p ) k = 1 !! � = ! ! 1 − p p ! k =1 !

  38. Derivation*of*geometric* expected*value* ∞ � k (1 − p ) k − 1 p E [ X ] = O k =1 ∞ � k (1 − p ) k − 1 = p k =1 - ∞ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! p k (1 − p ) k = 1 � ! = ! 1 − p ! p !!!!!!!!!!!!!! k =1 ! !! ! ! !

Recommend


More recommend