MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
ASSIGNMENT ONE
DUE: Tuesday, February 24th at 10am
(1)
(2)
(3)
(4)
(5)
(6)
January 20th homework [H5.pdf]: question 2.
January 22nd homework [H6.pdf]: nothing
February 3rd homework [H9.pdf]: nothing
Februar
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
Importance Sampling
We will consider the problem of estimating the integral
1
I =
4 1 x2 dx =
1
g(x)dx
0
0
We will do this using the idea of importance sampling: write
1
g(x)
f (x)dx =
0 f (x)
By considerin
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
Stratied Sampling
We will consider the problem of estimating the integral
1
I =
4 1 x2 dx =
0
1
g(x)dx
0
We will do this using the idea of stratied sampling: write
[0, 1] = S1 S2 Sm .
We will consider sever
# QUESTION 1
# GENERATING UNIFORM RVS BASED ON RANDU
# the function which does it all!
rRANDU <function(n, seed=12345)cfw_
x
<rep(0, n+1)
x[1]
<seed
for(i in 1:n)cfw_
x[i+1] <(65539*x[i]) % (2^31)
u
<x[-1]/2^(31)
return(u)
# let's see how it works:
n
<1
#Rao-Blackwellization example and in-class assignment
# approach one (no conditioning)
mu
sigma
v
h
<-
1
2
5
function(x)
exp(-x^2)
# generate non-central t rvs
n
<10^5
x
<mu+sigma*rt(n, df=v)
h
<h(x)
mean(h)
sd(h)
# approach one (with conditioning)
mu
sig
#1
#b
n<-1000
y <-runif(1000)
Fx <- x^2
i_Fx <- sqrt(y) # random variable
#c
hx <- function(x) (4-2*x)/3
i_H <- (4-sqrt(16-4*y)/2 # reject the (4-sqrt(16+4*y)/2 the value for x are
between 0 amd 1
#d
G <- function(x) 2*x -x^2
i_G <- (2- sqrt(4-4*y)/2
betw
n <- 1000
random_uniform <- runif(n,0,1)
x <- sort(random_uniform)
cdf_u <- function (x) (x-a)/(x-b)
#inverse method to genrate the random variables from the U~(0,1): m is number
of stratas, created a matrix
i_u <- function(m) cfw_
m1<- seq(0,1,length=(m+
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD - WINTER 2015
In this course, we will discuss what Monte Carlo methods are, and we will look at their varied applications. The three main topics we will cover are (a)basic Monte Carlo integration, (b) Marko
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
(1) Three white balls and three black balls are distributed in two urns in such a way that each
contains three balls. We say that the system is in state i, i = 0, 1, 2, 3 if the rst urn contains
i white bal
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
IN-CLASS ASSIGNMENT FOR THURSDAY APRIL 9th?
To complete this task, you will need to recall the following facts from basic probability and mathematical statistics: Suppose that I draw a sample of size n IID
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
IN-CLASS ASSIGNMENT
(1) Recreate Figures 6.1,6.2, and 6.4 in the text using data obtained from your own simulations
of the MH algorithm for this setting.
(2) Exercises 6.4, 6.7, and 6.9 in the text.
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
(1) A Markov chain is said to be symmetric if pxy = pyx for all x, y S. Consider a Markov
chain cfw_Xn , n = 0, 1, 2, . . . with a nite state space S. Suppose that this chain is symmetric,
irreducible, and
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
IN-CLASS ASSIGNMENT
(1) Recall the symmetric random walk dened by
P (Xn+1 = y|Xn = x) =
1/2 y = x 1
0 otherwise.
Show that the random walk has no stationary distribution. Give the distribution of Xn for
n =
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
(1) Exercise 6.13 in the Robert and Casella text (see March 24th homework for data and glm
code).
(2) Implement the bootstrap for the mean example done today in class, assuming that the true
distribution is
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
IN-CLASS ASSIGNMENT
(1) Go over the RW on the integers script and and answer the questions.
(2) Modify the RW script to generate a RW on the torus cfw_1, 2, 3, 4, 5 (this is an example from
class - note, it
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
(1) Suppose that U1 , U2 , U3 are IID Uniform[0,1] random variables. Find P (U1 < U2 < U3 ).
(2) The Pareto distribution has density
f (x) =
aba xa1 x b,
0
otherwise.
Explain how you would simulate a Pareto
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
ASSIGNMENT TWO
DUE: Thursday, April 16th at 10am
(1) March 17th homework [H16.pdf]: question 3.
(2) March 19th homework [H17.pdf]: Exercise 6.7 from the Robert/Casella text.
(3) March 26th homework [H19.pdf
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
(1) Suppose that U is a Uniform[0,1] random variable. Give the details on how to use the rejection
method to generate a sample from a Uniform[a,b] random variable.
(2) Recall that if U is a Uniform[0,1] ran
MATH 4931: SIMULATION AND THE MONTE CARLO METHOD
IN-CLASS ASSIGNMENT
(1) Create a program which generates a sequence of pseudo-random numbers based on RANDU.
(2) Consider the distribution of an exponential random variable with rate = 0.75. Write code
whic