12_Sim_Hw4_Sol

12_Sim_Hw4_Sol - IEOR 4404 Assignment #4 Solutions...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: IEOR 4404 Assignment #4 Solutions Simulation February 18, 2012 Prof. Mariana Olvera-Cravioto 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 Acceptance-Rejection 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.

Page1 / 6

12_Sim_Hw4_Sol - IEOR 4404 Assignment #4 Solutions...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online