$29.99
Math 525 – Statistics I
Assignment 3
Problem 1: In this problem, you will simulate normal observations of unknown mean and variance.
Consider the following hierarchical model
τ ∼ Gamma (φ, ψ)
µ|τ ∼ Normal
m,
n
τ
w|µ, τ ∼ Normal
µ,
1
τ
where φ, ψ and m, n attain known values.
(i) Use ancestral sampling to approximate empirically p(w). To sample gamma random variables
you may use randg or gamrnd. Similarly, to sample normal random variables you may use randn
or normrnd or the Box-Muller algorithm of Assignment 1.
(ii) Derive analytically p(w).
(iii) Compare visually the empirical p(w) of step (i) with the analytic p(w) of step (ii).
Associated data: For concreteness, in steps (i) and (iii) use the values φ = 2, ψ = 2.5 and
m = 10, n = 1.
Problem 2: In this problem, you will identify a graphical
model.
(i) List exhaustively every variable shown in the graphical
model on the right.
(ii) Sort the variables you identified in step (i) into three
groups: random variables with known values, random variables with unknown values, and variables that are not random.
υ
μt
n=1,...,Nt
ψ
wt,n
t=1,2
M
V
1
Problem 3: In this problem, you will implement a Monte Carlo method for the estimation of
multidimensional Gaussian integrals.
(i) Implement a Monte Carlo algorithm to generate samples from a Normal3 (m, S), where m
and S are given. To obtain a matrix L such that LLT = S, you may use chol(S,’lower’)
or any other factorization you prefer. To sample standard normal random variables you may use
randn or normrnd or the Box-Muller algorithm of Assignment 1.
(ii) Use the algorithm of step (i) to generate 1500 samples from
Normal3
x
y
z
;
1
2
3
,
1
1
2
0
1
2
1 0
0 0 1
and summarize them graphically. For the graphical summary you might use plotmatrix or any
other approach you prefer.
(iii) Use the samples generated in step (ii) to approximate the integral
ZZZ
A
Normal3
x
y
z
;
1
2
3
,
1
1
2
0
1
2
1 0
0 0 1
dxdydz
where A is a sphere of unit radius centered at the origin.
2