This preview shows pages 1–3. 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: IEOR 4404 Assignment #4 Solutions Simulation February 18, 2012 Prof. Mariana OlveraCravioto Page 1 of 6 Assignment #4 Solutions 1. The following MATLAB code computes 95% approximate confidence intervals for the ex pected number dice rolls that are needed: N = 1000; counts = ; for n=1:N outcomes = zeros(1,11); count = 0; while( prod( outcomes ) == 0 ) % generate a dice roll dice1 = floor( 6 * rand() ) + 1; dice2 = floor( 6 * rand() ) + 1; total = dice1 + dice2; outcomes( total  1 ) = 1; count = count + 1; end counts = [ counts count ]; end m = mean( counts ); sigma = std( counts ); CI = [ m  1.96 * sigma/N^.5, m + 1.96 * sigma/N^.5 ] The vector outcomes is used to keep track of the 11 possible outcomes. It is initialized as zeros(1,11) and then the ( i 1)th component of outcomes is set to 1 if outcome i is rolled. The while loop iterates until all components of outcomes are nonzero. Running the code gives the following output: CI = 60.7802 62.1818 2. According to the AcceptanceRejection algorithm, the probability of acceptance is 1 c , where c > 1 and h = g c . If we denote the distribution of the number of ( Y,U ) pairs that are rejected 2 IEOR 4404, Assignment #4 Solutions before acceptance occurs by X , then X + 1 is geometrically distributed with parameter 1 c , and the expected number of rejections is c 1. 3. (a) For any x [0 , 1], z = F X ( x ) = P ( X x ) = P (min { U 1 ,U 2 } x ) = 1 P (min { U 1 ,U 2 } > x ) = 1 P ( U 1 > x ) P ( U 2 > x ) = 2 x x 2 and for any z [0 , 1], F 1 X ( z ) = 1 1 z Then we generate U uniform on [0 , 1], and 1 1 U is what we want. (b) For any x [0 , 1], z = F X ( x ) = P ( X x ) = P (max { U 1 ,U 2 } x ) = P ( U 1 x ) P ( U 2 x ) = x 2 and for any z [0 , 1], F 1 X ( z ) = z Then we generate U uniform on [0 , 1], and U is what we want....
View
Full
Document
This note was uploaded on 03/18/2012 for the course IEOR 4404 taught by Professor C during the Spring '10 term at Columbia.
 Spring '10
 C

Click to edit the document details