Stat340: Computer Simulation of Complex Systems
Spring 2013
Assignment 2 Solutions
Professor: Ali Ghodsi
1
TA: Wu Lin
Question 1
2
We have f (x) = (2/ 2)ex /2 , x > 0 and g(x) = ex , so, f (x)/g(x) =
2
f (x)
max(f (x)/g(x) = 2e/ , therefore cg(x) = e(x1)
Comparing estimators for Call
Option Pricing Example
script9 uses a variety of estimators:
Best efficiency (74) for stratified-antithetic
0.37
[ f (.47 + .37U ) + f (.84 .37U )]
2
.16
+
[ f (.84 + .16U ) + f (1 .16U )]
2
This is stratified into [.47,.84]
Winter 2012
Stat 340
STAT 340 - Winter 2012
In this exam please assume the following:
1. Any Condence Intervals and Hypothesis Tests where the % are not given are at a 95% and 5% level
respectively.
2. You are marked according to the clarity and completne
STAT 340 - Assignment 1 - Winter 2014
Last (Family) Name:
First (Given) Name:
Numeric UW ID:
Quest User ID:
Group Work: Group work in STAT 340 is permitted on assignments. However, the work you
submit must be your own. If it is determined that your work i
Clicker Test WF - 14
1
Question 1: Let
= x 2 dx .
0
Given the uniform realizations 0.1, 0.7 and 0.9,
use ANTI to estimate .
A) 0.74
B) 0.37 C) 0.33
E) None of the above.
D) 0.44
2
Question 2: Let
= exp ( sin ( x ) ) dx .
3
Given the uniform realizations 0
Clicker Test WF - 10
Question 1: Classify each of the following sampling algorithms as:
A) Directly apply IVT
B) Maximum
C) Minimum
D) Composition
E) Minimum and Directly apply IVT
Part A: Write an algorithm to sample from:
Part B: Write an algorithm to s
Clicker Test MW - 14
Question 1: The estimator for antithetic random variables is given by
n
( g ( U i )+ g (V i )
~ i=1
=
2n
In each case please respond with:
A) TRUE
B) FALSE
Part 1:
Ui Ui
Part 2:
U i U j i j
Part 3:
Ui V i
Part 4:
U i V j i j
Part 5:
Clicker Test MW - 11
Question 1: Consider the code below, which is used to generate a
random variable from a Binomail.
Binomial = function(u)
cfw_ x = 0
f = .7^2
F = f
while (u>F)
cfw_
f = f*.3/.7*(2-x)/(x+1)
F = F + f
x = x + 1
return(x)
Part 1. Which B
Clicker Test MW - 7
Question 1: Consider the data described using the two
histograms below.
The data is: 0.4; 1.2; 1.2; 1.7; 1.8; 2.5; 3.8; 4.1; 4.4; 5.8; 6.5;
7.3; 9.9; 12.4; 13.1
Part i) What distribution does this data possibly have?
A) Exponential, B)
Clicker Test WF - 13
1
Question 1: Let
= x 2 dx .
0
use CMC to estimate
A)
B)
1
3
Given the uniform realizations 0.1, 0.7 and 0.9,
.
C) 0.57
D) 0.44
E) None of the above.
2
Question 2: Let
= exp ( sin ( x ) ) dx .
3
Given the uniform realizations 0.1, 0.
Clicker Test WF - 11
Question 1: Consider:
cfw_
f ( x )= 0.05 for x =1,3,5,7,9
0.15 for x=2,4,6,8,10
Part A. Note that x is uniformly 1,3,5,7,9. Given a uniform u , what
would be a formula for generating x over these values?
A)2floor(5u)+1 B) 2floor(6u)+1
Clicker Test MW - 4
Question 1: After midterm 1 I take a sample of 10 students
midterms. A 95% confidence interval for the mean midterm
grade based on this sample is ( 70,80 ) . Please answer each of
the following with either A) TRUE or B) FALSE:
a) We ar
Clicker Test 21
Consider the following realizations from a standard Normal
Random Variable: cfw_0.6, -2.1, -1.5
1. Using the realization(s) above which of the following
would be the realization of a log normal random
variable?
A) -0.51
B) Not a Number
C)
STAT 340 Test 3 Spring 2015
Basic Rules:
1. Only a math approved, non-programmable, non-graphical calculator is allowed.
2. Please put your cell phone in your bag. A cell phone that is within reach is considered to be an illegal
tool.
3. Please leave all
Clicker Test WF - 19
Question 1: An M/M/1 queue is one which,
A) Arrivals occur according to a poisson process.
B) Departures occur according to a poisson process.
C) The calling population is infinite.
D) All of the above.
E) None of the above.
Question
Clicker Test WF - 17
1
Question 1: Consider
estimate
1
= x dx
0
. We wish to use stratified sampling to
. We decide to break the interval at 3/4.
3 /4
1
= x dx= x dx + x dx
0
0
3/ 4
Part 1: What is the transformation that you will use for the first integr
Clicker Test WF - 15
Question 1: The (Optimal) Control Variate estimator is given by:
1
n
~
1
OCV = ( g ( X i )kh ( X i ) ) + k h ( x ) dx
n i=1
0
In each case below the answers are either:
A) TRUE
B) FALSE
1. X X i j
i
j
2.
g ( Xi) g ( X j) i j
3.
h ( X
Clicker Test MW - 15
1
Question 1: Let
= x 2 dx .
0
Given the uniform realizations 0.1, 0.7 and 0.9,
use ANTI to estimate .
A) 0.74
B) 0.37 C) 0.33
E) None of the above.
D) 0.44
2
Question 2: Let
= exp ( sin ( x ) ) dx .
3
Given the uniform realizations 0
Clicker Test WF - 16
Question 1: A particular variance reduction technique was used below.
u = runif(1000)
x = u^(2/3)
y = (exp(x)+x*exp(x)/(3/2*sqrt(x)
mean(y)
[1] 2.732461
Part 1: What variance reduction technique is it?
A) CMC B) OCV C) STRAT D) IMP E)
Clicker Test WF - 9
Question 1: Consider the LCG
x n=( 5 x n1+2 ) mod 9
.
Part a) Let the seed be x =12 then the first 10 pseudorandom numbers
are:
A) 8, 6, 4, 0, 2, 3, 8, 6, 4, 0
B) 8, 6, 5, 0, 2, 3, 8, 1, 2, 3
C) 8, 6, 3, 0, 2, 3, 0, 2, 3, 0
D) 8, 1, 5,
Clicker Test WF - 8
Question 1: Consider the data: x=c(0.1, 0.25, 0.7, 0.8). Is the
data from a F ( x )=x , 0< x <1 ? We start by building an ECDF:
^
Part i) The F values are:
A) c(1:4)/4 B) c(0:4)/4 C) c(1,2,4)/4 D) c(1/4,2/4,3/4)
E) None of the above
^
Clicker Test MW - 18
1
Question 1: Consider
estimate
1
= x dx
0
. We wish to use stratified sampling to
. We decide to break the interval at 3/4.
3 /4
1
= x dx= x dx + x dx
0
0
3/ 4
Part 1: What is the transformation that you will use for the first integr
Clicker Test MW - 13
1
Question 1: Let
= ln ( x +1 ) dx .
0
0.9, use CMC to estimate
A) 5.05
B) 2 ln 21
E) None of the above.
Given the uniform realizations 0.1, 0.7 and
.
C) 0.5
D) 0.4
2
Question 2: Let
= exp ( x ) dx .
3
Given the uniform realizations 0
STAT 340 - Assignment 2 - Winter 2014
Last (Family) Name:
First (Given) Name:
Numeric UW ID:
Quest User ID:
Due Date: This is due on Feb. 28th at 9:30 in the morning either in the drop box on the 4th floor
of MC OR, if requested in the question, online.
G
STAT 340 - Assignment 3 - Winter 2014
Last (Family) Name:
First (Given) Name:
Numeric UW ID:
Quest User ID:
Due Date: This is due on Mar. 5th at 9:30 in the morning either in the drop box on the 4th floor
of MC OR, if requested in the question, online.
Gr
STAT 340 - Assignment 3 - Winter 2014
Last (Family) Name:
First (Given) Name:
Numeric UW ID:
Quest User ID:
Due Date: This is due on Mar. 5th at 9:30 in the morning either in the drop box on the 4th floor
of MC OR, if requested in the question, online.
Gr
Clicker Test MW - 10
Question 1: Classify each of the following sampling algorithms as:
A) Directly apply IVT
B) Maximum
C) Minimum
D) Composition
E) Minimum and Directly apply IVT
Part A: Write an algorithm to sample from:
Part B: Write an algorithm to s
Clicker Test WF - 6
Question 1: Consider the data described using the two
histograms below.
The data is: 0.4; 1.2; 1.2; 1.7; 1.8; 2.5; 3.8; 4.1; 4.4; 5.8; 6.5;
7.3; 9.9; 12.4; 13.1
Part i) What distribution does this data possibly have?
A) Exponential, B)
Clicker Test WF - 5
Question 1: A 90% confidence interval for a proportion is given as
(17,23)%. Perform a suitable test of hypothesis to determine
whether or not the population proportion is less than 16%.
Part i) What was the original sample size?
A) 48
Clicker Test WF - 7
Question 1: Consider the data: x=c(0.1, 0.25, 0.7, 0.8). Is the
data from a F ( x )=x ?
We start by building an ECDF:
^
Part i) The F values are:
A) c(1:4)/4 B) c(0:4)/4 C) c(1,2,4)/4 D) c(1/4,2/4,3/4)
E) None of the above
^
Part ii) T
Clicker Test WF - 18
Last class we covered the montreal problem. The following questions
refer to what we covered.
Question 1: How many transmission lines were there?
A) 4
B) 7
C) 8
D) 9
E) None of the above.
Question 2: How many paths bring electricity t
Clicker Test MW - 5
Question 1: A 90% confidence interval for a proportion is given as
(17,23)%. Perform a suitable test of hypothesis to determine
whether or not the population proportion is greater than 24%.
Part i) What was the original sample size?
A)
Clicker Test MW - 1
Question 1: Let
L=X + 2Y +1
. Then
X BIN (2,0.5)
and let
Y exp(0.5)
. Let
E ( L )=
A)
2.5
B)
3
C)
4
D)
6
E) None of the above
Question 2: What is the result of the following R
code?
X = c(-1,2,4)
Y = c(X[-2],X[c(1,3)])
sort(Y)
A)X
B)(-
Clicker Test MW - 8
Question 1: Consider the data: x=c(0.1, 0.25, 0.7, 0.8). Is the
data from a F ( x )=x , 0< x <1 ? We start by building an ECDF:
^
Part i) The F values are:
A) c(1:4)/4 B) c(0:4)/4 C) c(1,2,4)/4 D) c(1/4,2/4,3/4)
E) None of the above
^
Clicker Test WF - 4
Question 1a: After midterm 1 I take a sample of 10
students midterms. A 90% confidence interval for the
mean midterm grade based on this sample is ( 70,80 ) . Please
answer each of the following with either:
A) TRUE
B) FALSE
C) Maybe
P