辅导案例-QBUS3830

QBUS3830
Advanced Analytics
Semester 2, 2020
Homework Task 2 (10%)
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
• Please include your SID in the assignment.
• Each question carries 50 marks.
• You must submit all the m-files together with your assignment via Turnitin.
Page 2

欢迎咨询51作业君
51作业君 51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: ITCSdaixie