STAT314/461 Assignment 5
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
STAT314/461 Semester 2, 2021
Assignment 5
Instructions
1. Total Marks: This assessment can be worth 10% of your final grade (7.5% for STAT461 students). Remember, the best four of your assign-ments will count for the internal component of your final grade. Note that there is a “bonus question” worth 4 marks. You do not have to complete this question for the assignment. However, if you do submit the question, the marks from this question can be used to top-up your mark from Questions 1 and 2, in the (unlikely) event that you don’t quite get full marks for those questions. Otherwise, you can regard the bonus question as practice, either to be done now or later during revision for the exam.
2. Official due date: 11:55pm Friday October 2021;
3. While you are welcome and encouraged to discuss assignment problems with other STAT314/461 students you must ultimately submit a docu-ment that persuades the marker that you, individually, understand the material.
Questions
1. Consider a Metropolis-Hastings algorithm that by iteration (t − 1) has reached the point
, i.e
.
Consider another point in the parameter space,
which is such that
where
is an asymmetric density, so
![]()
Write down an expression for the probability of the Metropolis-Hastings sampler moving to
at the
iteration, given that it is
at iteration (t − 1). The expression should involve only the posterior density (or the unnormalised posterior density) and the jumping density (Hint: The answer is not just
!) [ 3 marks ].
2. Suppose a survey of exercise habits is conducted and asks participants about the number of days out of the last 7 that they have engaged in moderate or vigorous exercise for 30 or more minutes. Let Y denote the response (number of days). We consider that the survey respondents are a mixture of “never-exercisers,” Z = 0, and occasional or regular exercisers, Z = 1. However the survey asks only about the last 7 days and not about regular or typical exercise habits. Consequently Z is not directly observed. We adopt the model
and beta priors:![]()
We let
and make the usual conditional independence assumptions over individuals, so
where the last equality follows because Y = 0 when Z = 0. Note also that the model for Y depends on θ, whereas the model for Z depends on
but not
.
(a) Derive an expression for the probability that a survey respondent who reports no exercise in the last 7 days (Y =0) is, in fact, and occasional or regular exerciser; i.e. derive an an expression for Pr(Z = 1|Y = 0,
,
). [ 3 marks ]
(b) The full conditional posterior distributions for the remaining pa-rameters are
Using these full conditionals and your answer to part (a) imple-ment a Gibbs sampler for this problem using the data in exercise.rds.The implementation should involve multiple chains and some check for convergence. You can use the shell programme exercise shellcode.r to get started. The program reads in the data and a function for convergence checking, GRchunk.r. [ 4 marks ].
Bonus question Derive the full conditionals for
and
. i.e show the condi-tional posteriors given above for
and
are the correct conditional posterior distributions for this problem. [ 4 marks ].
2021-10-17
, i.e
.
which is such that
is an asymmetric density, so 
at the
iteration, given that it is
at iteration
!) 
and make the usual 