of 24 /24
LECTURE 25 SIMULATION AND MODELING Md. Tanvir Al Amin, Lecturer, Dept. of CSE, BUET CSE 411

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

Embed Size (px)

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

  • LECTURE 25SIMULATION AND MODELINGMd. Tanvir Al Amin, Lecturer, Dept. of CSE, BUETCSE 411

  • Recap : Inverse Transform MethodFind cumulative distribution functionLet it be FFind F-1X = F-1(R) is the desired variate where R ~ U(0,1)Other methods areAccept Reject techniqueComposition methodConvolution techniqueSpecial observations

  • Random variate for Continuous DistributionWe already covered for continuous case :Proof of inverse transform method(Kelton 8.2.1 pg440)Exponential distribution (Banks 8.1.1)Uniform distribution (Banks 8.1.2)Weibull distibution (Banks 8.1.3)Triangular distribution (Banks 8.1.4)Empirical continuous distribution (Banks 8.1.5)Continuous distributions without a closed form inverse (Self study Banks 8.1.6)

  • Banks Chapter 8.1.7 + Kelton 8.2.1Inverse Transform method for Discrete Distributions

  • Things to rememberIf R ~ U(0,1), A Random variable X will assume value x whenever,

    Also we should know the identities :

    We could use this identity also, It results in F-1(R) = floor(x) which is not useful because x is already an integer for discrete distribution.

  • Discrete DistributionsR1 = 0.65F(x) = F(1) = 0.8F(x-1) = F(0) = 0.4X = 1

  • Empirical Discrete DistributionSay we want to find random variate for the following discrete distribution.

    At first find the F



  • Empirical Discrete Distribution

  • Discrete Uniform DistributionConsider

  • Discrete Uniform DistributionGenerate R~U(0,1)123K-1k , output X= 1 output X= 2 output X= 3, output X= i output X= 4If generated

  • Discrete Uniform DistributionImp : Expand this method for a general discrete uniform distribution DU(a,b)

  • Discrete Uniform DistributionAlgorithm to generate random variate for p(x)=1/k where x = 1, 2, 3, k

    Generate R~U(0,1) uniform random numberReturn ceil(R*k)

  • Geometric Distribution

    Recall :

  • Geometric DistributionAlgorithm to generate random variate for

    Generate R~U(0,1) uniform random numberReturn ceil(ln(1-R)/ln(1-p)-1)

  • Proof of inverse transform method for Discrete caseKelton 8.2.1 Page 444We need to show that

  • Disadvantage of Inverse Transform MethodKelton page 445-448DisadvantageNeed to evaluate F-1. We may not have a closed form. In that case numerical methods necessary. Might be hard to find stopping conditions.For a given distribution, Inverse transform method may not be the fastest way

  • Advantage ofInverse Transform MethodStraightforward method, easy to useVariance reduction techniques has an advantage if inverse transform method is usedFacilitates generation of order statistics.

  • Kelton 8.2.2Composition Technique

  • Composition TechniqueApplies when the distribution function F from which we wish to generate can be expressed as a convex combination of other distributions F1, F2, F3, i.e., for all x, F(x) can be written as

  • Composition AlgorithmTo generate random variate forStep 1 : Generate a positive random integer j such that

    Step 2 : Return X with distribution function Fj

  • Geometric InterpretationFor a continuous random variable X with density f, we might be able to divide the area under f into regions of areas p1,p2,(corresponding to the decomposition of f into its convex combination representation)Then we can think of step 1 as choosing a regionStep 2 as generating from the distribution corresponding to the chosen region

  • Example

    0 a 1-a 1

  • Example

  • Proof of composition techniqueKelton page 449