STAT 340 - Assignment 4 - Winter 2014
Last (Family) Name:
First (Given) Name:
Numeric UW ID:
Quest User ID:
Due Date: This is due on April 4th 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
HT Example 1
The average change in the value of a stock
portfolio is measured by taking a sample of 32
stocks from the portfolio and calculating the
value = current price prior price. This change
is on average $-373 with a standard deviation of
$4.25.
a)
Clicker Test STAT 340 - 7
Question 1: We generate, using R, data that follows from a
standard normal distribution. The code is:
data = rnorm(1000,0,1)
Interval
Observed Probability Expected
( ,1) (1, )
354
(1,0)
318
0.34
(0,1)
0.34
Is the data generated u
Clicker Test S340 5A
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 a
Clicker Test S340 - 15
Question 1. Consider the code below, which is used to generate a
random variable from a Binomial.
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
Clicker Test S340 - 1
Question 1: What is the result of the following R codes?
Part A: pnorm(1.96,0,1)
A) 0 B) 0.5 C) 0.95 D) 0.975 E) None of the above
Part B: dbinom(1,2,0.5)
A) 0 B) 0.25 C) 0.5 D) 0.75 E) None of the above
Part C: X=c(1,2,0); X=X[-1];
Clicker Test STAT 340 - 8
People arrive at the Math C&D according to the following times (in
minutes):
1.8, 5.7, 7.1, 7.2, 9.1, 36.2, 41.9, 42.2, 53.4, 62.4, 63.9,
73.0, 84.9, 93.5, 97.6, 97.9, 104.8, 115.6, 117.3, 121.4
Question 1: What is a good distrib
Clicker Test S340 - 9
Question 1: Consider the data: x=c(0.1, 0.25, 0.7, 0.8,0.85). Is
the data from a F ( x )=x for 0< x <1 ?
We start by building an ECDF:
^
Part i) The F values are:
A) c(1:5)/5 B) c(0:4)/5 C) c(1,2,4)/5 D) c(1/5,2/5,3/5,4/5)
E) None of
Clicker Test S340 - 4
A random number generator randomly selects a
number uniformly between 0 and 100. i.e.
X U ( 0,100 )
. If 3 numbers are generated at random
1 What is the probability the maximum number
is more than 50?
A 1/8 B) C) 7/8 D) E) None of th
Clicker Test S340 12
1. Let
for 0 x 1. Let U U ( 0,1 ) with a
realization u=0.2 . Using the IVT what would
be the corresponding random variable
generated from F(x) using u.
A) 0.008 B) 0.04 C) 0.2 D) 0.45 E) None of the above
2. Let F ( x )= x for 0 x 1.
Clicker Test S340 - 10
Question 1: Consider the data: x=c(0.1, 0.25, 0.7, 0.8,0.85). Is
the data from a F ( x )=x for 0< x <1 ?
We start by building an ECDF:
^
Part i) The F values are:
A) c(1:5)/5 B) c(0:4)/5 C) c(1,2,4)/5 D) c(1/5,2/5,3/5,4/5)
E) None o
Clicker Test S340 - 4
A random number generator randomly selects a
number uniformly between 0 and 100. i.e.
X U ( 0,100 )
. If 3 numbers are generated at random
1 What is the probability the maximum number
is less than 50?
A 1/8 B) C) 7/8 D) E) None of th
Clicker Test S340 - 10
Question 1: Consider the data: x=c(0.1, 0.25, 0.7, 0.8,.85). Is the
data from a F ( x )=x for 0< x <1 ?
We start by building an ECDF:
^
Part i) The F values are:
A) c(1:5)/5 B) c(0:4)/5 C) c(1,2,4)/5 D) c(1/5,2/5,3/5,4/5)
E) None of
Additional practice questions on LEARN:
1. Explain in one sentence what a model is.
A model tries to capture key characteristics, aspects/functions of the system
under consideration.
2.
Give two pitfalls of simulation.
(1) Failure to collect enough data t
Example:
I played resident evil 60 times on level 1. There are 6
zombies on level 1. I assume:
1.
2.
3.
4.
I dont die on level 1.
The chance I kill a zombie is 50%.
Killing one zombie is independent of killing
another zombie.
There is one chance to kill e
Min Max Example 1
Men and women arrive independently to a line
according to a poisson process. The interarrival
(times between arrivals) times of the women
are therefore,
A) Pois
( W )
B) Exp
( W )
C) N
( W , W2 )
And the interarrival times of the men is
CI Example
Doctors suspect that people waiting more than
3 hours leave undiagnosed from the ER. At GRH
the average wait time is 2 hours from a sample
of 35 patients with a standard deviation of 30
minutes. Build a 95% confidence interval for
the average w
Sample Size Example
Doctors suspect that people waiting more than
3 hours leave undiagnosed from the ER. At GRH
the average wait time is 2 hours from a sample
of 35 patients with a standard deviation of 30
minutes. How big should my sample size be to
be a
HT Example 2
We have 800 simulations of collisions between
smart cars and transport trucks. 632 resulted in
fatalities. Is the proportion of deaths more than
75%? Perform a suitable hypothesis test to answer
the question.
Distribution
data = read.csv("dist_data_1.csv")
data = unlist(data)
hist(data)
Is the distribution?
A) Normal
B) T
C) Exp
D) Gamma
E) Chi Squared
Answer! Exp(.75)
data = read.csv("dist_data_2.csv")
data = unlist(data)
hist(data)
Is the distribution?
A) No
Marius Hofert
University of Waterloo
2015-02-03
STAT 340: Computer Simulation of Complex Systems
Assignment 2 (due on 2015-02-17)
Exercise 8 (Sampling methods)
(4+4+4=12 points)
a) Let b R. Give a sampling algorithm for F (x) = (1 exp(2x(x b)[b,) (x) base
Marius Hofert
University of Waterloo
2017-01-06
STAT 340: Computer Simulation of Complex Systems
Assignment 1 (due on 2017-01-20)
Exercise 1 (Distribution functions)
(1+3+2+1+2+3+1=13 points)
Let X F , that is, X is a random variable (rv) with distributio
Hello Actuarial Science Students,
Here is your Spring newsletter. This term there are some reminders, some updates, and an
announcement from the SAS Chair. As always if you have any questions about any of these please
Stat 340 Spring 2010
Test 1 Stat 340
Last (Family) Name: First (Given) Name:
Note: The back is easier than this page.
1. In Wiarton (a small town north of here), there is a 2 taxi service (no kidding) to shuttle people from place to
place. The interarri
Clicker Test STAT 340 - 7
Question 1: We generate, using R, data that follows from a
standard normal distribution. The code is:
data = rnorm(1000,0,1)
Interval
Observed Probability Expected
( ,1) (1, )
318
(1,0)
354
0.34
(0,1)
0.34
Is the data generated u
Clicker Test S340 - 3
Let X exp ( ) and Y N ( , ) and Z GAM ( m , ) .
Let X Y Z for all i .
What is the distribution of each of the following
quantites?
A) Normal
B) Exponential
C) Gamma
D) Chi-squared
E) Unknown
1. Z
2. Z + Z
3. X + Z
2
i
i
i
4.
(
i
1
2
Clicker Test S340 6
Question 1: The 15 sampled midterms provide a 95%
confidence interval, for the mean midterm grade, of
( 70,80 )
. The instructor believes the mean grade will be
more than 79. What is the corresponding pvalue?
A) (.05,.1)
B) (.90,.95)
C
Clicker Test 14
1. Let U U ( 0,1 ) with a realization u=0.5 . Let
X~Geo(0.3). What is the corresponding value
for x given the realization above?
A) 0 B) 1 C) 2 D) 3 E) None of the above
2. Let U~U(0,1). What formula can be used to
generate a random variab
Clicker Test 14
1. Let U U ( 0,1 ) with a realization u=0.5 . Let
X~Geo(0.3). What is the corresponding value
for x given the realization above?
A) 3 B) 2 C) 1 D) 0 E) None of the above
2. Let U~U(0,1). What formula can be used to
generate a random variab
Clicker Test S340 13
1. Let
A)
x2 1 1
(
)
F X = 2 cos ( x ) for 0 x . Let U , V U ( 0,1 )
2 2
(
)
be two
random variables with realizations u=0 and
v =1
. Using IVT what would be the
corresponding random variable generated
from F(x) using u, and v.
B) co