# 辅导案例-QBUS3830

QBUS3830
Semester 2, 2020
1 Questions
Simulation studies are often used to examine how methodologies work. This question is about
a simulation study that examines the performance of MCMC and VB.
Consider a Poisson regression model
yi|µi ∼ Poisson(µi), i = 1, . . . , n
log(µi) = β0 +
4∑
j=1
xijβj.
Let’s simulate a data set D from the above model as follows: Generate the covariates
xij ∼ U(0, 1), i = 1, . . . , n = 100; j = 1, . . . , 4. Set β = (1,−0.2, 0.4, 0.1,−0.7) and
generate a data set of n = 100 observations according to the given model. Please fix the
random seed so that your results are reproducible. Consider the prior p(β) = N(0, 102I).
1. Perform Bayesian inference on β using MCMC:
• Use a Metropolis-Hastings algorithm to estimate the posterior distribution of β.
• Show the trace plots for each component βj. Make sure that your chain has
converged.
• Report estimates for the posterior mean and posterior standard deviation for each
βj.
• Given a future subject with covariates x∗ = (1.8339,−2.2588, 0.8622, 0.3188),
estimate the predictive mean E(y∗|x∗, D) based on your MCMC samples.
2. Perform Bayesian inference on β using VB:
• Derive and implement a VB algorithm for approximating the posterior distribu-
tion of β.
• Show the trace plot of the moving averaged lower bounds. Make sure that you
have a smooth plot and that the lower bounds increase over iterations.
• Report estimates for the posterior mean and posterior standard deviation for each
βj.
• Given a future subject with covariates x∗ = (1.8339,−2.2588, 0.8622, 0.3188),
estimate the predictive mean E(y∗|x∗, D) based on your VB approximation.
2 Instructions  