{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

rng_330_3 - Generating Random Numbers Some Examples Example...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Generating Random Numbers: Some Examples Example 1: The following 10 numbers are realizations from a Standard Uniform distribution: .54463 .15389 .85961 .61149 .05219 .41417 .28357 .17783 .40950 .82995 Explain how to use these numbers to generate 10 iid Bernoulli random numbers with a success probability p = . 4. Generate a sample of size 10 from that distribution. Solution: Let Y i = ( 1 if 0 < U i . 4 , 0 if . 4 < U i < 1 , for i = 1 , . . . , 10. Thus by inverse cdf method Y 1 , . . . , Y 10 are iid Bernoulli ( . 4) Here the sample generated is 0 , 1 , 0 , 0 , 1 , 0 , 1 , 1 , 0 , 0 Example 2: Generate a random sample of size 10 from the Bin ( n = 10 , p = . 4) using the above values from U (0 , 1) Solution: X Bin ( n, p ) means that X is the number of successes in n iid Bernoulli trials with a success probability p . Thus X = Y 1 + Y 2 , . . . + Y n where Y 1 , . . . , Y n are iid Bernoulli ( p ). In Problem 1, we generated Y 1 , . . . , Y 10 iid Bernoulli ( . 4). Thus set X = Y 1 + Y 2 , . . . + Y 10 to obtain X Bin (10 , . 4). Here, a value from Bin (10 , . 4) is generated as X = 0+1+0+0+1+0+1+1+0+0 = 4. To generate another value from Bin (10 , . 4), one needs to repeat the whole procedure, beginning with obtaining a new sample from Standard Uniform. Thus this method is the least efficient
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '11
  • Zhou
  • Probability theory, probability density function, Cumulative distribution function, Discrete probability distribution, inverse cdf method

{[ snackBarMessage ]}