Top Banner
LECTURE 14 SIMULATION AND MODELING Md. Tanvir Al Amin, Lecturer, Dept. of CSE, BUET CSE 411
25

Lecture 14 Simulation and Modeling

Feb 23, 2016

Download

Documents

nyoko

Lecture 14 Simulation and Modeling. Md. Tanvir Al Amin, Lecturer, Dept. of CSE, BUET. CSE 411. Discrete Uniform Distribution. Uniform distribution inside a interval. Say a random variable is equally likely to take value between i and j inclusive What is the probability that X = x where - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture 14 Simulation and Modeling

LECTURE 14SIMULATION AND MODELINGMd. Tanvir Al Amin, Lecturer, Dept. of CSE, BUETCSE

411

Page 2: Lecture 14 Simulation and Modeling

Discrete Uniform Distribution Uniform distribution inside a interval.

Say a random variable is equally likely to take value between i and j inclusive

What is the probability that X = x where

Mean

Variance

jxi

11)(

ij

xp

2)( ji

121)1( 2 ij

Page 3: Lecture 14 Simulation and Modeling

Discrete Uniform Distribution

Probability Mass Probability Distribution

otherwise ,0

},.....1,{ x if ,1

1)( jii

ijxP

jx

jxiijix

ix

xF

if , 1

if ,11

if , 0

)(

Page 4: Lecture 14 Simulation and Modeling

Binomial Distribution Number of successes in n independent

Bernoulli trials with probability p of success in each trial

Relation between bernoulli and binomial : Suppose a two-tailed experiment

Pick a ball from the urn : Ball is either blue or red So two tailed test Pr { Blue } = 6/10 = 0.6 Pr { Red } = 4/10 = 0.4 This is a bernoulli trial

Page 5: Lecture 14 Simulation and Modeling

Binomial Distribution Now suppose we have n such urns…

Pick a ball from urn 1, Pick a ball from urn 2, Pick a ball from urn 3…

All are independent events. Each of these parallel experiments have Pr{red}=0.4, and Pr{blue} = 0.6

Urn 1 Urn 2 Urn 3 Urn 4 Urn 5

Page 6: Lecture 14 Simulation and Modeling

Binomial Distribution All are independent events. Each of

these parallel experiments have Pr{red}=0.4, and Pr{blue} = 0.6

Does it mean, all of these experiments will have same outcome ?

NO !!!

Page 7: Lecture 14 Simulation and Modeling

One Experiment

2 red, 3 blue balls …

Page 8: Lecture 14 Simulation and Modeling

Another Experiment

4 red, 1 blue balls …

Page 9: Lecture 14 Simulation and Modeling

Binomial Distribution What is the probability that outcome is 1

red ball ? i.e. (4 blue balls) What is the probability that outcome is 3

red balls ? (and hence 2 blue balls)

Answer : Binomial Distribution…probability of x success in n independent two tailed tests ….

xnx ppxn

xp

)1()(

Page 10: Lecture 14 Simulation and Modeling

Binomial Dist.

Mass function for various value of p

n = 15n = 5P = 0.9, 0.5, 0.2

Page 11: Lecture 14 Simulation and Modeling

Binomial Distribution

Distribution

Page 12: Lecture 14 Simulation and Modeling

Binomial Distribution Mean Variance If Y1, Y2, … Yn are independent bernoulli

RV and Y is bin(n,p) then Y = Y1 + Y2 + …. Yn

If X1, X2… Xm are independent RV and Xi ~ bin(ni,p) then X1 + X2 + … + Xm ~ bin(t1+t2+…….tm, p)

np

)1( pnp

Page 13: Lecture 14 Simulation and Modeling

Binomial Distribution The bin(n,p) distribution is symmetric if

and only if p=1/2 X~ bin(n, p) if and only if X ~ bin (n, 1-p) The bin(1,p) and Bernoulli(p)

distributions are same

Page 14: Lecture 14 Simulation and Modeling

Geometric Distribution Number of failures before first success in

a sequence of independent Bernoulli trials with probability p of success on each trial…

The probability distribution of the number X of Bernoulli trials needed to get one success…

Page 15: Lecture 14 Simulation and Modeling

Geometric Distribution From previous example

Say blue ball = failure Say red ball = success Say we have infinite urns.

Step 1 C = 0 Step 2 Take a new urn Step 3 We pic one ball Step 4 If the ball is red, we are done … Print C

Else If the ball is blue C = C + 1, goto step 2 Now, what is the probability that C will be 5

?? Or 3 ?? Or 0 ??

Page 16: Lecture 14 Simulation and Modeling

Geometric Distribution Probability of x failures

= x blue balls followed by 1 red ball So

otherwise ,0

0 if ,)1()(

xppxp

x

x times failure(1-p) to the power xFollowed by 1

success

Page 17: Lecture 14 Simulation and Modeling

Geometric Distribution Mean

Variance

MLE :

pp1

2

1pp

1)(1

nXp

Page 18: Lecture 14 Simulation and Modeling

Geometric Distribution If X1, X2 … Xs are independent geom(p)

random variables, then X1 + X2 + … + Xs has a negative binomial distribution with parameters s and p

The geometric distribution is the discrete analog of the exponential distribution, in the sense that it is the only discrete distribution with the memoryless property.

The geom(p) distribution is a special case of the negative binomial distribution (with s=1 and the same value for p)

Page 19: Lecture 14 Simulation and Modeling

Negative Binomial Distribution Number of failures before the s-th

success in a sequence of independent bernoulli trials with probability p of success on each trial.

Number of good items inspected before encountering the s-th defective item

Number of items in a batch of random size

Number of items demanded from an inventory

Page 20: Lecture 14 Simulation and Modeling

Negative Binomial Distribution

Mean :

Variance:

otherwise ,0

0 xif ,)1(1

)(xs pp

xxs

xp

pps )1(

2

)1(pps

Page 21: Lecture 14 Simulation and Modeling

Negative Binomial Distribution

Page 22: Lecture 14 Simulation and Modeling

Poisson Distribution Number of events that occur in an

interval of time when the events are occuring at a constant rate

Number of items in a batch of random size

Number of items demanded from an inventory

Page 23: Lecture 14 Simulation and Modeling

Poisson Distribution

Mean : Variance: MLE :

otherwise ,0

0 if ,!)( xx

exp

x

)(nX

Page 24: Lecture 14 Simulation and Modeling

Poisson Distribution If Y1, Y2 …. be a sequence of non

negative IID random variables and let Then the distribution of the Yi‘ If and only if X ~ Poisson(λ)

}1:max{1

i

j

YjiX

}1{exp o

Page 25: Lecture 14 Simulation and Modeling

Poisson Distribution If X1, X2, … .Xm are independent Random

variables and Xi ~ Poisson (λi), Then X1+ X2 + X3 …. Xm ~ Poisson (λ1 +λ2 … +λm)