10SimHw3Solution

10SimHw3Solution - IEOR E4404.001 SIMULATION Prof. Mariana...

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

View Full Document Right Arrow Icon
IEOR E4404.001 SIMULATION Prof. Mariana Olvera-Cravioto Assignment #3 Solutions 1. The following MATLAB code computes 95% approximate confidence intervals for the expected 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
Background image of page 1

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

View Full DocumentRight Arrow Icon
k = 10 3 k = 10 4 k = 10 5 exact Cov ( U,e U ) [0 . 1017; 0 . 1961] [0 . 1315; 0 . 1618] [0 . 1376; 0 . 1471] 0 . 1409 Table 1: For Question 2 2. The exact answer is: Cov (U ,e U ) = E [ Ue U ] - E [ U ] E [ e U ] = 1 0 xe x dx - 1 2 ( e - 1) = [ xe x ] 1 0 - 1 0 e x dx - 1 2 ( e - 1) = 1 - 1 2 ( e - 1) 0 . 1409 On the other hand, the Monte Carlo approximation of Cov ( U,e U ) is simply given by: 1 k k i =1 U i e U i - ( 1 k k i =1 U i ) ( 1 k k i =1 e U i ) We provide with a 95% Confidence Interval of Monte Carlo approximation of Cov ( U,e U ). 3. According to the acceptance-rejection algorithm, the probability of rejection is
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/17/2010 for the course IEOR IEOR 4404 taught by Professor C during the Spring '10 term at Columbia.

Page1 / 5

10SimHw3Solution - IEOR E4404.001 SIMULATION Prof. Mariana...

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