Outline Review Practice Problems! Review Time! Random Variables - - PowerPoint PPT Presentation

โ–ถ
outline
SMART_READER_LITE
LIVE PREVIEW

Outline Review Practice Problems! Review Time! Random Variables - - PowerPoint PPT Presentation

Outline Review Practice Problems! Review Time! Random Variables Joint Distributions Joint RV Statistics Conditional Distribution General Inference Practice Problems! Probability Distributions Expectation &


slide-1
SLIDE 1

Outline

  • Review
  • Practice Problems!
slide-2
SLIDE 2

Review Time!

  • Random Variables
  • Joint Distributions
  • Joint RV Statistics
  • Conditional Distribution
  • General Inference
  • Practice Problems!
slide-3
SLIDE 3

Probability Distributions

slide-4
SLIDE 4

Expectation & Variance

Discrete definition Continuous definition

๐น ๐‘Œ = $

!:# ! $%

๐‘ž ๐‘ฆ โ‹… ๐‘ฆ

Wait for itโ€ฆ

slide-5
SLIDE 5

Expectation & Variance

Properties of Expectation Properties of Variance

E[X + Y ] = E[X] + E[Y ] E[aX + b] = aE[X] + b ๐น ๐‘• ๐‘Œ = %

!

๐‘• ๐‘ฆ ๐‘ž(๐‘ฆ)

Discrete definition Continuous definition

๐น ๐‘Œ = $

!:# ! $%

๐‘ž ๐‘ฆ โ‹… ๐‘ฆ

Wait for itโ€ฆ Var(X) = E[(X โˆ’ ฮผ)2] Var(X) = E[X2] โˆ’ E[X]2 Var(aX + b) = a2Var(X)

slide-6
SLIDE 6

All our (discrete) friends

Ber(p) Bin(n, p) Poi(ฮป) Geo(p) NegBin (r, p) P(X) = p

๐‘œ ๐‘™ ๐‘ž! 1 โˆ’ ๐‘ž "#!

๐œ‡!๐‘“"# ๐‘™!

(1 โˆ’ p)kโˆ’1p

๐‘™ โˆ’ 1 ๐‘  โˆ’ 1 ๐‘ž$ 1 โˆ’ ๐‘ž !#$

E[X] = p E[X] = np E[X] = ฮป E[X] = 1 / p E[X] = r / p Var(X) = p(1-p) Var(X) = np(1-p) Var(X) = ฮป

1 โˆ’ p p2 r(1 โˆ’ p) p2

1 experiment with prob p of success n independent trials with prob p of success Number of success over experiment duration, ฮป rate

  • f success

Number of independent trials until first success Number of independent trials until r successes

slide-7
SLIDE 7

Probability Distributions

slide-8
SLIDE 8

All our (continuous) friends

For continuous RVs, we need to calculate the PDF, instead of the PMF PDF for RV X ๐‘” ๐‘ฆ โ‰ฅ 0 such that โˆ’โˆž < ๐‘ฆ < โˆž ๐‘„ ๐‘ โ‰ค ๐‘ฆ โ‰ค ๐‘ = -

! "

๐‘” ๐‘ฆ ๐‘’๐‘ฆ

slide-9
SLIDE 9

Expectation & Variance

๐น ๐‘Œ = $

! "

๐‘ฆ โ‹… ๐‘” ๐‘ฆ ๐‘’๐‘ฆ

Discrete definition Continuous definition

๐น ๐‘Œ = $

!:# ! $%

๐‘ž ๐‘ฆ โ‹… ๐‘ฆ

slide-10
SLIDE 10

Expectation & Variance

Properties of Expectation Properties of Variance

E[X + Y ] = E[X] + E[Y ] E[aX + b] = aE[X] + b Var(X) = E[(X โˆ’ ฮผ)2] Var(X) = E[X2] โˆ’ E[X]2 Var(aX + b) = a2Var(X) ๐น ๐‘• ๐‘Œ = %

!

๐‘• ๐‘ฆ ๐‘ž(๐‘ฆ)

Discrete definition Continuous definition

๐น ๐‘Œ = $

!:# ! $%

๐‘ž ๐‘ฆ โ‹… ๐‘ฆ

๐น ๐‘Œ = $

! "

๐‘ฆ โ‹… ๐‘” ๐‘ฆ ๐‘’๐‘ฆ

slide-11
SLIDE 11

All our (continuous) friends

Uni(ฮฑ, ฮฒ) Exp(ฮป)

N(ฮผ, ฯƒ 2)

E[X] = 1 / ฮป E[X] = ฮผ

Duration of time until success

  • ccurs. ฮป is rate of

success

f(x) = ฮปeโˆ’ฮปx

F(x) = 1 โˆ’ eโˆ’ฮปx

P(a โ‰ค X โ‰ค b)= &'(

)'*

f(x) =

! "โˆš$% ๐‘“

! "!# $ $%$

Var(x) = ฯƒ2

๐’ˆ ๐’š = ๐Ÿ ๐œธ โˆ’ ๐œท

๐‘ฎ ๐’š = ๐” ๐’š โˆ’ ๐‚ ๐‰ ๐…[๐’€] = ๐œท + ๐œธ ๐Ÿ‘

Var(x) = !"# !

$%

Var(x) =

$ &!

slide-12
SLIDE 12

Approximations

When can we approximate a binomial?

  • Poisson
  • n > 20
  • p is small
  • ฮป = np is moderate
  • n > 20 and p < 0.05
  • n > 100 and p < 0.1
  • Slight dependence ok
  • Normal
  • n > 20
  • p is moderate
  • np(1-p)> 10
  • Independent trials
slide-13
SLIDE 13

Continuity correction

slide-14
SLIDE 14

Joint Distributions โ€“ Discrete

px,y(a, b) = P(X = a, Y = b) Px(a) =โˆ‘) ๐‘„

*,)(๐‘, ๐‘ง)

slide-15
SLIDE 15

Multinomial RVs

Joint PMF ๐‘„ ๐‘Œ+ = ๐‘‘+, ๐‘Œ, = ๐‘‘,, โ€ฆ , ๐‘Œ- = ๐‘‘- = ๐‘œ ๐‘‘+, ๐‘‘, โ€ฆ , ๐‘‘- ๐‘ž+

.!, ๐‘ž, ." โ€ฆ ๐‘ž- .#

Where โˆ‘/0%

  • ๐‘‘/ = ๐‘œ

Generalize to Binomial RVs

slide-16
SLIDE 16

Independent Discrete RVs

Two discrete random variables X and Y are independent if for all x,y: ๐‘„ ๐‘Œ = ๐‘ฆ, ๐‘ = ๐‘ง = ๐‘„ ๐‘Œ = ๐‘ฆ ๐‘„(๐‘ = ๐‘ง) Sum of independent Binomials ๐‘Œ + ๐‘~๐ถ๐‘—๐‘œ ๐‘œ+ + ๐‘œ,, ๐‘ž Sum of independent Poisson RVs ๐‘Œ + ๐‘~๐‘„๐‘๐‘—(๐œ‡+ + ๐œ‡,)

slide-17
SLIDE 17

Covariance

๐ท๐‘๐‘ค ๐‘Œ, ๐‘ = ๐น ๐‘Œ โˆ’ ๐น ๐‘Œ ๐‘ โˆ’ ๐น ๐‘ = ๐น ๐‘Œ๐‘ โˆ’ ๐น ๐‘Œ ๐น[๐‘]

slide-18
SLIDE 18

Covariance

๐ท๐‘๐‘ค ๐‘Œ, ๐‘ = ๐น ๐‘Œ โˆ’ ๐น ๐‘Œ ๐‘ โˆ’ ๐น ๐‘ = ๐น ๐‘Œ๐‘ โˆ’ ๐น ๐‘Œ ๐น[๐‘] How do you calculate variance of two RVs? ๐‘Š๐‘๐‘  ๐‘Œ + ๐‘ = ๐‘Š๐‘๐‘  ๐‘Œ + 2 โ‹… ๐ท๐‘๐‘ค ๐‘Œ, ๐‘ + ๐‘Š๐‘๐‘  ๐‘

slide-19
SLIDE 19

Covariance

๐‘Š๐‘๐‘  ๐‘Œ + ๐‘ = ๐‘Š๐‘๐‘  ๐‘Œ + 2 โ‹… ๐ท๐‘๐‘ค ๐‘Œ, ๐‘ + ๐‘Š๐‘๐‘  ๐‘ When X and Y are independent ๐‘Š๐‘๐‘  ๐‘Œ + ๐‘ = ๐‘Š๐‘๐‘  ๐‘Œ + ๐‘Š๐‘๐‘ (๐‘) Note when we only know Cov(X,Y)=0 we canโ€™t assume X and Y are independent

slide-20
SLIDE 20

Correlation

Correlation of X and Y ๐œ ๐‘Œ, ๐‘ = ๐ท๐‘๐‘ค(๐‘Œ, ๐‘) ๐œ1๐œ2 Note: โˆ’1 โ‰ค ๐œ ๐‘Œ, ๐‘ โ‰ค 1 Measures the linear relationship between X and Y

slide-21
SLIDE 21

Conditional Distribution

Conditional PMF for discrete X given Y ๐‘„ ๐‘Œ = ๐‘ฆ ๐‘ = ๐‘ง =

#(%&',)&*) #()&*)

Conditional Expectation ๐น ๐‘Œ ๐‘ = ๐‘ง = (

'

๐‘ฆ๐‘„(๐‘Œ = ๐‘ฆ|๐‘ = ๐‘ง)

slide-22
SLIDE 22

Conditional Distribution

Law of Total Expectation ๐น ๐น ๐‘Œ ๐‘ = (

*

๐‘„ ๐‘ = ๐‘ง ๐น ๐‘Œ ๐‘ = ๐‘ง = ๐น[๐‘Œ] Stay tuned!

slide-23
SLIDE 23

General Inference

General Inference

slide-24
SLIDE 24

General Inference

General Inference

slide-25
SLIDE 25

General Inference

Bayesian Networks

slide-26
SLIDE 26

Practice Time

  • Quiz Logistics and Coverage
  • Random Variables
  • Joint Distributions
  • Joint RV Statistics
  • Conditional Distribution
  • General Inference
  • Practice Problems!
slide-27
SLIDE 27

Practice Problems

  • 500 year flood planes (โ€œa previous examโ€ on

website)

  • The Huffmeister floodplane in Houston has historically

been estimated to flood at an average rate of 1 flood for every 500 years.

  • What is the probability of observing at least 3

floods in 500 years?

  • What is the probability that a flood will occur within

the next 100 years?

  • What is the expected number of years until the

next flood?

slide-28
SLIDE 28

Practice Problems

  • What is the probability of observing at least 3 floods in

500 years?

  • Poisson with lambda = 1 (flood per 500 years)
  • P(X >= 3) = 1 โ€“ P(X < 3) = 1 โ€“ (sum of P(X=i) from 0 to 2)
  • 1 โ€“ 5/2e
  • What is the probability that a flood will occur within the

next 100 years?

  • Exponential with lambda = 1/500
  • F(100) = 1 โ€“ e^(-0.2)
  • What is the expected number of years until the next

flood?

  • Expectation for an exponential RV is 1/lambda = 500
slide-29
SLIDE 29

Practice Problems

  • Recursive Code Problem

Consider the following recursive function

slide-30
SLIDE 30

Practice Problems

What is E[Y]?

slide-31
SLIDE 31

Practice Problems

What is E[Y]? First notice Far() calculated based on Near()

slide-32
SLIDE 32

Practice Problems

Probability for Far() is based on Near(), so calculate E[X] E[X] = 1/4(2 + 4 + E[6 + X] + E[8 + X]) = 1/4(2 + 4 + 6 + E[X] + 8 + E[X]) = 1/4(20 + 2E[X]) = 5 + 1/2E[X] So, E[X] = 10

slide-33
SLIDE 33

Practice Problems

Now we are ready to calculate E[Y] E[Y] = 1/3(2 + E[2 + X] + E[4 + Y]) = 1/3(2 + 2 + E[X] + 4 + E[Y]) = 1/3(8 + E[X] + E[Y]) = 1/3(8 + 10 + E[Y]) = 18/3 + 1/3E[Y] So, E[Y] = 9

slide-34
SLIDE 34

Practice Problems

What is Var[Y]?

slide-35
SLIDE 35

Practice Problems

Calculate E[X^2]

E[X^2 ] = 1/4(2^2 + 4^2 + E[(6 + X)^2 ] + E[(8 + X)^2 ] = 1/4(4 + 16 + 36 + 12E[X] + E[X^2 ] + 64 + 16E[X] + E[X^2 ]) = 1/4(120 + 28E[X] + 2E[X^2 ]) = 1/4(120 + 28(10) + 2E[X^2 ]) = 1/4(400 + 2E[X^2 ]) = 100 + 1/2E[X^2 ] So, E[X^2 ] = 2(100) = 200

slide-36
SLIDE 36

Practice Problems

Calculate E[Y^2]

E[Y^2 ] = 1/3(2^2 + E[(2 + X)^ 2 ]+ E[(4 + Y)^2 ] = 1/3(4 + 4 + 4E[X] + E[X^2 ] + 16 + 8E[Y] + E[Y^2 ]) = 1/3(24 + 40 + E[X^2 ] + 8(9) + E[Y^2 ]) = 1/3(136 + 200 + E[Y^2 ]) = 1/3(336 + E[Y^2 ]) So, E[Y^2 ] = 336/2 = 168

slide-37
SLIDE 37

Practice Problems

Now that we have E[X^2] and E[Y^2], we are ready to calculate Var(Y) Var(Y)= E[Y^2 ] โ€“ E[Y]^2 = 168 โ€“ (9)^2 = 168 โ€“ 81 = 87

slide-38
SLIDE 38

Good Luck!!!