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 #11 Solutions Simulation 16th December 2006 Prof. Mariana Olvera-Cravioto Page 1 of 4 Assignment #11 Solutions 1. clear all; N=10; lamda=1/2; for i=1:N U=rand; E(i)=0-(1/lamda)*log(U); end X=sort(E,ascend); for i=1:N D1(i)=i/N-(1-exp((-1)*X(i)/2)); D2(i)=1-exp((-1)*X(i)/2)-(i-1)/N; end Dn=max(max(D1),max(D2)) %calculate Dn for 10 exponential variables SS=100000; %sample size I=0; for j=1:SS for i=1:N U(i)=rand; end Y=sort(U,ascend); for i=1:N D1(i)=i/N-Y(i); D2(i)=Y(i)-(i-1)/N; end if max(max(D1),max(D2))>Dn I=I+1; end end PValue=I/SS %P-Value 2. (a) We need to use Y = 2 - Z =- Z as an antithetic variable. Please refer to the code in part b. (b) %using raw estimator clear all; N=1000000; for i=1:N Z=randn; X(i)=(Z^3)*exp(Z); end mean(X) std(X) %using antithetic variables for i=1:N Z=randn; Y(i)=((Z^3)*exp(Z)-(Z^3)*exp((-1*Z)))/2; end mean(Y) std(Y) 2 IEOR 4404, Assignment #11 Solutions error=1.960201*std(Y)/(N^0.5) 3. (a) As in the notes, we compute c * as follows: c * =- cov ( I,X ) var ( X ) Now, cov ( I,X ) = E [ IX ]- E [ I ] E [ X ]. And, E [ IX ] = E [ IX | X a ] P [ X a ] = E [ X | X a ] P [ X a ] = a . And, E [ I ] E [ X ] = a 1 / 2 = a/ 2. Substituting, we get that cov ( I,X ) = a/ 2....
View Full Document
- Spring '10