统计代写-Q1
时间:2022-05-09
SECTION A
Q1 Let θ denote the average recovery time (in days) for patients with a disease. You
are interested in specifying a suitable prior distribution for θ, and you wish to elicit
it based on expert knowledge. Your expert judges that φ = θα, for some α > 0, has
an exponential distribution with cumulative distribution function
F (φ) =
{
1− exp(−βφ) for φ ∈ (0,+∞)
0 otherwise
for some β > 0. In addition, from his graduate school studies, he judges that there is
25% probability that θ < 8 days and 25% probability that θ > 15 days. Specify the
prior distribution for θ that you can use in your analysis by stating its probability
density function and computing its hyper-parameter values.
Q2 Suppose that y1, ...yn are a random sample from a uniform distribution on the range
(0, θ). Assume that γ = log(θ) admits a Normal prior distribution with known mean
µ and variance σ2. Calculate the posterior distribution of γ given the observations,
including an explicit formula for the normalising constant.
Hint: nγ + 1
2σ2
(γ − µ)2 = 1
2σ2
(γ − µ+ nσ2)2 + nµ− 1
2
n2σ2
SECTION B
Q3 Let y = (y1, ..., yn) be a sequence of n observables assumed to be iid according to a
Log-Normal sampling distribution with parameters µ ∈ R and σ2 ∈ (0,+∞); i.e.
yi|µ, σ2 iid∼ LN(µ, σ2) , i = 1, ..., n
where µ is an unknown parameter, and σ2 is assumed known.
Hint: The Log-Normal distribution denoted by LN(µ, σ2) has density function
f(x|µ, σ2) =
{
1√
2piσ2
1
x
exp
(
−1
2
(log(x)−µ)2
σ2
)
, if x ∈ (0,+∞)
0 , otherwise
(a) Show that the LN distribution with known σ2 is an exponential family of
distributions.
(b) Compute the likelihood of y given (µ, σ2) and its sufficient statistic.
(c) Derive the prior distribution which is conjugate to the likelihood function of
the problem.
(d) Using the conjugate prior, construct the (1 − a)100% HPD posterior cred-
ible interval for µ, and show your working. Compute the bounds of the
95% HPD posterior credible interval for µ, when there is available a data-
set y = (0.05, 0.36, 0.13, 0.22, 0.60) of size n = 5 observations; σ2 = 1; the prior
mean of µ is 0; and the prior variance of µ is 10.
Hint: The 0.975-quantile of the standard Normal distribution is z∗0.975 = 1.959964.
Q4 Consider random variables θ ∼ N(0, 1) and y | θ ∼ N(θ, 1), and a loss function
`(θ, d) = (θ − d)2 for all d ∈ R and θ ∈ R. We denote as N(µ, σ2), the Normal
distribution with mean µ and variance σ2.
(a) Consider a decision rule δa, where δa(y) = ay for all y ∈ R, and where a ∈ R
is an arbitrary constant. Show that the (Frequentist) risk function for decision
δa is
R(θ, δa) = (1− a)2θ2 + a2.
(b) Show that δa is inadmissible when a < 0 or a > 1.
(c) Compute the Bayesian point estimator of θ under the aforesaid loss function
and Bayesian model. State if this estimator is admissible and justify your
answer.
Q5 (a) Consider the following probability density function, which is known up to a
constant of proportionality
f(x) =
ex
c
,
where x ∈ [0, 1]. Assuming the numbers below are a sequence of independent
random numbers uniformly distributed on [0, 1], generate 3 values from f(x)
using inverse sampling.
0.156 0.579 0.936
(b) The Kumaraswamy distribution is a flexible alternative to the beta distribu-
tion. The probability density function of this distribution is given by
f(x) = αβx(α−1)(1− xα)(β−1),
where x ∈ (0, 1), α > 0 and β > 0. Assuming that α = β = 2, perform 3
iterations of rejection sampling from f(x) using a uniform distribution on [0, 1]
as proposal distribution. State whether the generated values are accepted or
not. Base your calculations on the following sequence of uniformly distributed
random numbers between 0 and 1:
0.046 0.495 0.307 0.138 0.645 0.515
(c) We want to use Gibbs sampling to sample from the joint distribution of A and
B, which has probabilities proportional to the table below.
B
1 2 3
4 0.4 0.5 0.8
A 5 0.4 0.6 0.5
6 0.5 0.7 0.9
Generate the output of the Gibbs sampler assuming availability of the sequence
of uniform random numbers in [0, 1] given below and using as initial value
B(0) = 2.
0.963 0.801 0.526 0.039 0.101 0.675
Q6 A colony of insects is studied with a view to quantifying variation in the number
of eggs laid and in the rate at which eggs successfully develop. Let Ni denote the
number of eggs laid by insect i, for i = 1, . . . , n, and Ei the number of eggs which
develop. Eggs laid by insect i develop independently with probability of success
pi. Expert judgment is that the variability between insects in numbers of eggs laid
should be modelled well by a Poisson distribution with fixed rate λ. Furthermore, it
is thought that a beta distribution with fixed parameters α and β would adequately
describe variability between insects with respect to pi.
(a) Draw a directed acyclic graph using plate notation for the Bayesian network
describing the joint distribution of the {Ni}, {Ei} and {pi} based on the above,
and add vertices for the parameters λ, α and β.
(b) Specify the distributions for the vertices {Ni}, {Ei} and {pi} given their re-
spective parents.
(c) On closer inspection, the experts are uneasy about the choice of fixed values of
the parameters. Therefore, the model is modified by assigning exponential prior
distributions with rate 1 for the parameters α and β of the beta distribution
and an improper prior proportional to 1/λ for λ. Derive (up to multiplicative
constants) all the conditional distributions required for Gibbs sampling. Which
of the conditional distributions are known distributions and what are their
parameters?
(d) Describe an efficient approach to generating values from each of the conditional
distributions in part (c). You may refer to standard functions in R or name
standard algorithms. For any algorithm you name, show that preconditions (if
any) for its application are met. You may use the fact that the third derivative
of log Γ(x) is negative for all positive x, where Γ(·) is the gamma function.
Hint-1: The Poisson distribution for x ∈ {0, 1, . . . } with parameter λ takes the
form
P (x|λ) = e−λλ
x
x!
.
Hint-2: The pdf of a beta-distributed random quantity x ∈ (0, 1) with parameters
a and b is
f(x|a, b) = Γ(a+ b)
Γ(a)Γ(b)
xa−1(1− x)b−1.
Hint-3: The exponential distribution for x ∈ [0,∞) with parameter θ takes the
form
f(x|θ) = θe−θx.
SECTION C
Q7 Consider a two dimensional Gaussian distribution P (x) with axes aligned with the
direction e(1) = (1, 1) and e(2) = (1,−1). Let the variances in these two directions
be σ21 and σ
2
2.
(a) What is the optimal variance if this distribution P (x) is approximated by a
spherical Gaussian Q
(
x;σ2Q
)
with variance σ2Q , optimized by the Variational
inference method.
Hint: Essentially, P denotes N
(
0,
[
σ21 0
0 σ22
])
andQ denotes N
(
0,
[
σ2Q 0
0 σ2Q
])
.
(b) If we instead optimized the objective function
G = −

log
(
P (x)
Q (x;σ2)
)
P (x) dx
what would be the optimal value of σ2?
(c) Sketch a contour of the true distribution P (x) and the two approximating
distributions in the case σ1/σ2 = 10.
Note: This exercise explores the assertion, that the approximations given by varia-
tional free energy minimization (Variational Inference) always tend to be more
compact than the true distribution.
Note: In general it is not possible to evaluate the objective function G, because
integrals under the true distribution P (x) are usually intractable.

essay、essay代写