This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 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 , , , 1 , , 1 , 1 , , 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...
View
Full
Document
This note was uploaded on 02/01/2012 for the course STAT 330B taught by Professor Zhou during the Spring '11 term at Iowa State.
 Spring '11
 Zhou

Click to edit the document details