Probability and Statistics for Computer Science Can we call - - PowerPoint PPT Presentation

probability and statistics
SMART_READER_LITE
LIVE PREVIEW

Probability and Statistics for Computer Science Can we call - - PowerPoint PPT Presentation

Probability and Statistics for Computer Science Can we call the e exci-ng ? e n 1 + 1 e = lim n n Credit: wikipedia Hongye Liu, Teaching Assistant Prof, CS361, UIUC, 9.29.2020 Last time Objectives Poisson


slide-1
SLIDE 1

ì

Probability and Statistics for Computer Science

Can we call the exci-ng ?

Hongye Liu, Teaching Assistant Prof, CS361, UIUC, 9.29.2020 Credit: wikipedia

e = lim

n→∞

  • 1 + 1

n n

e e

slide-2
SLIDE 2

Last time

slide-3
SLIDE 3

Objectives

✺ Poisson distribu-on ✺ Con-nuous Random Variable ✺ Uniform Con-nuous distribu-on ✺ Exponen-al distribu-on

slide-4
SLIDE 4

Motivation for a model called Poisson Distribution

✺ What’s the probability of the number of

incoming customers (k) in an hour?

✺ It’s widely applicable in physics

and engineering both for modeling of -me and space.

Simeon D. Poisson (1781-1840) Credit: wikipedia

slide-5
SLIDE 5

Poisson Distribution

✺ A discrete random variable X is called

Poisson with intensity λ (λ>0) if

Simeon D. Poisson (1781-1840)

P(X = k) = e−λλk k!

for integer k ≥ 0

λ is the average rate of the event′s occurrence

x

slide-6
SLIDE 6

Poisson Distribution

✺ Poisson distribu-on is a valid pdf for

Simeon D. Poisson (1781-1840)

P(X = k) = e−λλk k!

for integer k ≥ 0

λ is the average rate of the event′s occurrence

x

  • i=0

λi i! = eλ ⇒

  • k=0

λke−λ k! = 1

slide-7
SLIDE 7

Poisson Distribution

✺ Poisson distribu-on is a valid pdf for

Simeon D. Poisson (1781-1840)

P(X = k) = e−λλk k!

for integer k ≥ 0

λ is the average rate of the event′s occurrence

x

  • i=0

λi i! = eλ ⇒

  • k=0

λke−λ k! = 1

x

slide-8
SLIDE 8

Expectations of Poisson Distribution

✺ The expected value and the variance are

wonderfully the same! That is λ

Simeon D. Poisson (1781-1840)

P(X = k) = e−λλk k!

for integer k ≥ 0

E[X] = λ var[X] = λ

x

slide-9
SLIDE 9

Examples of Poisson Distribution

✺ How many calls does a call center get in an hour? ✺ How many muta-ons occur per 100k

nucleo-des in an DNA strand?

✺ How many independent incidents occur in an

interval?

P(X = k) = e−λλk k!

for integer k ≥ 0

slide-10
SLIDE 10

Poisson Distribution: call center

✺ If a call center receives 10

calls per hour on average, what is the probability that it receives 15 calls in a given hour?

✺ What is λ here? ✺ What is P(k=15)?

Credit: wikipedia

slide-11
SLIDE 11
  • Q. Poisson Distribution: call center

If a call center receives 4 calls per hour on average. What is intensity λ here for an hour?

  • A. 1
  • B. 4
  • C. 8

Credit: wikipedia

slide-12
SLIDE 12
  • Q. Poisson Distribution: call center

If a call center receives 4 calls per hour on average. What is probability the center receives 0 calls in an hour?

  • A. e-4
  • B. 0.5
  • C. 0.05

Credit: wikipedia

slide-13
SLIDE 13
  • Q. Poisson Distribution: call center

Credit: wikipedia

✺ Given a call center receives

10 calls per hour on average, what is the intensity λ of the distribu-on for calls in Two hours?

slide-14
SLIDE 14

Example of a continuous random variable

✺ The spinner ✺ The sample space for all outcomes is

not countable

θ

θ ∈ (0, 2π]

slide-15
SLIDE 15

Probability density function (pdf)

✺ For a con-nuous random variable X, the

probability that X=x is essen-ally zero for all (or most) x, so we can’t define

✺ Instead, we define the probability density

func;on (pdf) over an infinitesimally small interval dx,

✺ For a < b

p(x)dx = P(X ∈ [x, x + dx])

b

a

p(x)dx = P(X ∈ [a, b])

P(X = x)

slide-16
SLIDE 16

Properties of the probability density function

✺ resembles the probability func-on

  • f discrete random variables in that

✺ for all x ✺ The probability of X taking all possible

values is 1.

p(x) p(x) ≥ 0

−∞

p(x)dx = 1

slide-17
SLIDE 17

Properties of the probability density function

✺ differs from the probability

distribu-on func-on for a discrete random variable in that

✺ is not the probability that X = x ✺ can exceed 1

p(x) p(x) p(x)

slide-18
SLIDE 18

Probability density function: spinner

✺ Suppose the spinner has equal chance

stopping at any posi-on. What’s the pdf of the angle θ of the spin posi-on?

✺ For this func-on to be a pdf,

Then

θ

2π c

p(θ) =

  • c

if θ ∈ (0, 2π]

  • therwise

−∞

p(θ)dθ = 1

slide-19
SLIDE 19

Probability density function: spinner

✺ What the probability that the spin angle θ is

within [ ]?

π 12, π 7

slide-20
SLIDE 20

Q: Probability density function: spinner

✺ What is the constant c given the spin angle θ

has the following pdf? θ

p(θ)

π

c

  • A. 1
  • B. 1/π
  • C. 2/π
  • D. 4/π
  • E. 1/2π
slide-21
SLIDE 21

Expectation of continuous variables

✺ Expected value of a con-nuous random

variable X

✺ Expected value of func-on of con-nuous

random variable

E[X] = ∞

−∞

xp(x)dx E[Y ] = E[f(X)] = ∞

−∞

f(x)p(x)dx

Y = f(X)

x

weight

slide-22
SLIDE 22

Probability density function: spinner

✺ Given the probability density of the spin angle θ ✺ The expected value of spin angle is

p(θ) = 1

if θ ∈ (0, 2π]

  • therwise

E[θ] = ∞

−∞

θp(θ)dθ

slide-23
SLIDE 23

Properties of expectation of continuous random variables

✺ The linearity of expected value is true for

con-nuous random variables.

✺ And the other proper-es that we derived

for variance and covariance also hold for con-nuous random variable

slide-24
SLIDE 24

Q.

✺ Suppose a con-nuous variable has pdf

What is E[X]?

  • A. 1/2
  • B. 1/3
  • C. 1/4
  • D. 1
  • E. 2/3

p(x) =

  • 2(1 − x)

x ∈ [0, 1]

  • therwise

E[X] = ∞

−∞

xp(x)dx

slide-25
SLIDE 25

Continuous uniform distribution

✺ A con-nuous random variable X is

uniform if

X

b a 1 1 b − a

p(x)

slide-26
SLIDE 26

Continuous uniform distribution

✺ A con-nuous random variable X is

uniform if

p(x) =

  • 1

b−a

for x ∈ [a, b]

  • therwise

E[X] = a + b 2 & var[X] = (b − a)2 12

X

b a 1

p(x)

1 b − a

slide-27
SLIDE 27

Continuous uniform distribution

✺ A con-nuous random variable X is

uniform if

✺ Examples: 1) A dart’s posi-on thrown on the

target

p(x) =

  • 1

b−a

for x ∈ [a, b]

  • therwise

E[X] = a + b 2 & var[X] = (b − a)2 12

X

b a 1

p(x)

1 b − a

slide-28
SLIDE 28

Continuous uniform distribution

✺ A con-nuous random variable X is

uniform if

✺ Examples: 1) A dart’s posi-on thrown on the

target 2) Olen associated with random sampling

p(x) =

  • 1

b−a

for x ∈ [a, b]

  • therwise

E[X] = a + b 2 & var[X] = (b − a)2 12

X

b a 1

p(x)

1 b − a

slide-29
SLIDE 29

Cumulative distribution of continuous uniform distribution

✺ Cumula-ve distribu-on func-on (CDF)

  • f a uniform random variable X is:

X

b a 1

p(x)

1 b − a

X

b a

CDF P(X ≤ x) = x

−∞

p(x)dx

1

slide-30
SLIDE 30

Exponential distribution

✺ Common

Model for wai-ng -me

✺ Associated

with the Poisson distribu-on with the same λ

p(x) = λe−λx for x ≥ 0

Credit: wikipedia

slide-31
SLIDE 31

Exponential distribution

✺ A con-nuous random variable X is exponen-al

if it represent the “-me” un-l next incident in a Poisson distribu-on with intensity λ. Proof See Morris et al Pg 324.

✺ It’s similar to Geometric distribu;on – the

discrete version of wai-ng in queue

✺ Both are memory-less. See Degroot et al Pg

322

p(x) = λe−λx for x ≥ 0

slide-32
SLIDE 32

Exponential distribution

✺ A con-nuous random variable X is exponen-al

if it represent the “-me” un-l next incident in a Poisson distribu-on with intensity λ. Proof See Morris et al Pg 324.

✺ It’s similar to Geometric distribu;on – the

discrete version of wai-ng in queue

p(x) = λe−λx for x ≥ 0

slide-33
SLIDE 33

Expectations of Exponential distribution

✺ A con-nuous random variable X is exponen-al

if it represent the “-me” un-l next incident in a Poisson distribu-on with intensity λ.

p(x) = λe−λx for x ≥ 0

E[X] = 1 λ & var[X] = 1 λ2

x

slide-34
SLIDE 34

Example of exponential distribution

✺ How long will it take un-l the next call to be

received by a call center? Suppose it’s a random variable T. If the number of incoming call is a Poisson distribu-on with intensity λ = 20 in an hour. What is the expected -me for T?

slide-35
SLIDE 35

Q:

✺ A store has a number of customers coming on

  • Sat. that can be modeled as a Poisson

distribu-on. In order to measure the average rate of customers in the day, the staff recorded the -me between the arrival of customers, can he reach the same goal?

  • A. Yes B. No
slide-36
SLIDE 36

Normal (Gaussian) distribution

✺ The most famous con-nuous random variable

distribu-on. The probability density is this:

Carl F. Gauss (1777-1855) Credit: wikipedia

p(x) = 1 σ √ 2π exp(−(x − µ)2 2σ2 )

E[X] = µ & var[X] = σ2

slide-37
SLIDE 37

Normal (Gaussian) distribution

✺ The most famous con-nuous random variable

distribu-on. p(x) = 1 σ √ 2π exp(−(x − µ)2 2σ2 )

E[X] = µ & var[X] = σ2

?

Carl F. Gauss (1777-1855) Credit: wikipedia

slide-38
SLIDE 38

Normal (Gaussian) distribution

✺ The most famous con-nuous random variable

distribu-on. p(x) = 1 σ √ 2π exp(−(x − µ)2 2σ2 )

E[X] = µ & var[X] = σ2

? +∞

−∞

p(x)dx = 1

Carl F. Gauss (1777-1855) Credit: wikipedia

slide-39
SLIDE 39

Normal (Gaussian) distribution

✺ A lot of data in nature are approximately

normally distributed, ie. Adult height, etc. p(x) = 1 σ √ 2π exp(−(x − µ)2 2σ2 )

E[X] = µ & var[X] = σ2

Carl F. Gauss (1777-1855) Credit: wikipedia

slide-40
SLIDE 40

Spread of normal (Gaussian) distributed data

Credit: wikipedia

99.7% 95% 68%

slide-41
SLIDE 41

Standard normal distribution

✺ If we standardize the normal distribu-on (by

subtrac-ng μ and dividing by σ), we get a random variable that has standard normal distribu-on.

✺ A con-nuous random variable X is standard

normal if

p(x) = 1 √ 2π exp(−x2 2 )

slide-42
SLIDE 42

Derivation of standard normal distribution

p(x) = 1 √ 2π exp(−x2 2 )

+∞

−∞

p(x) dx = +∞

−∞

1 σ √ 2π exp(−(x − µ)2 2σ2 ) dx = +∞

−∞

1 σ √ 2π exp(− ˆ x2 2 )σ dˆ x = +∞

−∞

1 √ 2π exp(− ˆ x2 2 ) dˆ x = +∞

−∞

p(ˆ x) dx

Call this standard and omit using a hat ˆ x = x − µ σ

slide-43
SLIDE 43
  • Q. What is the mean of standard normal?
  • A. 0
  • B. 1
slide-44
SLIDE 44
slide-45
SLIDE 45
  • Q. What is the standard deviation of

standard normal?

  • A. 0
  • B. 1
slide-46
SLIDE 46

Standard normal distribution

✺ If we standardize the normal distribu-on (by

subtrac-ng μ and dividing by σ), we get a random variable that has standard normal distribu-on.

✺ A con-nuous random variable X is standard

normal if

p(x) = 1 √ 2π exp(−x2 2 )

E[X] = 0 & var[X] = 1

slide-47
SLIDE 47

Another way to check the spread of normal distributed data

✺ Frac-on of normal data within 1 standard

devia-on from the mean.

✺ Frac-on of normal data within k standard

devia-ons from the mean.

1 √ 2π 1

−1

exp(−x2 2 )dx ≃ 0.68

1 √ 2π k

−k

exp(−x2 2 )dx

slide-48
SLIDE 48

Additional References

✺ Charles M. Grinstead and J. Laurie Snell

"Introduc-on to Probability”

✺ Morris H. Degroot and Mark J. Schervish

"Probability and Sta-s-cs”

slide-49
SLIDE 49

Qs for discrete distributions

slide-50
SLIDE 50

Q.

✺ A store staff mixed their fuji and gala

apples and they were individually wrapped, so they are indis-nguishable. Given there are 70% of fuji, if I want to know what is the probability I get 7 fuji in 20 apples? What is the distribu-on I should use?

  • A. Bernoulli
  • B. Binomial
  • C. Geometric
  • D. Poisson
  • E. Uniform
slide-51
SLIDE 51

Q.

✺ A store staff mixed their fuji and gala

apples and they were individually wrapped, so they are indis-nguishable. Given there are 70% of fuji, if I want to know what is the probability I get 7 fuji in 20 apples? What is the distribu-on I should use? What is the probability?

slide-52
SLIDE 52

Q.

✺ A store staff mixed their fuji and gala

apples and they were individually wrapped, so they are indis-nguishable. Given there are 70% of fuji, if I want to know the probability of picking the first gala on the 7th -me (I can put back aler each pick). What is the distribu-on I should use?

  • A. Bernoulli
  • B. Binomial
  • C. Geometric
  • D. Poisson
  • E. Uniform
slide-53
SLIDE 53

Q.

✺ A store staff mixed their fuji and gala

apples and they were individually wrapped, so they are indis-nguishable. Given there are 70% of fuji, if I want to know the probability of picking the first gala on the 7th -me (I can put back aler one pick). What’s the probability?

slide-54
SLIDE 54

Q.

✺ A store staff mixed their fuji and gala

apples and they were individually wrapped, so they are indis-nguishable. Given there are 70% of fuji, what’s the average ;mes of picking to get the first gala?

slide-55
SLIDE 55

See you next time

See You!