Assignment title: Information
MCMC Methods
##Please make sure that any plots/graphics used are small in size
(i.e. small in Mb, such as jpeg)!
Data are collected on the relationship between the length of time spent telephoning in a day to the
number of phone calls that were made. The data are presented in Table 1, where yi denotes the
total length of telephone calls made and the explanatory variables, xi, the number of telephone
calls made, by individual i = 1; : : : ; 20 (where all individuals make at least one phonecall).
yi xi yi xi
13.9 3 40.7 9
27.3 6 67.0 12
21.0 4 83.7 14
3.7 1 111.9 17
48.4 9 120.8 18
86.4 15 11.4 3
7.1 1 18.2 5
36.6 7 8.6 2
22.7 6 34.6 8
11.4 2 70.4 12
Table 1: The total length of time spent telephoning in a given day, yi, compared to the number
of telephone calls made, xi for individual i = 1; : : : ; 20.
We assume a quadratic relationship, so that,
yi = α + βxi + γx2 i + ϵi;
where
ϵi ∼ N(0; σ2):
Note that for simplicity, we do not normalise the explanatory variables here, but simply use the
raw xi values.
We specify the priors:
α ∼ N(µα; σα 2 ); β ∼ N(µβ; σβ 2);
γ ∼ N(µγ; σγ 2); σ2 ∼ Γ−1(a; b):
1) Suggest vague prior parameter values for each prior distribution.
2) Write WinBUGS/OpenBUGS/JAGS code to implement the MCMC algorithm and obtain
posterior estimates of the parameters of interest (note that you need to include your code,
and tell me which software to run it in). Perform a prior sensitivity analysis and comment
on the results.
3) Calculate the posterior conditional distributions for each of the parameters { i.e. for α, β, γ
and σ2. (Note that these are all standard distributions.)
4) Write an MCMC algorithm in R (i.e. adapt an MCMC algorithm in R from those provided in
Lecture 19) to sample from the posterior distribution of the parameters. (Again, you need
to include your R code.)
5) Check that the posterior results obtained from your R code are comparable to those obtained
within BUGS/JAGS.