Department of Statistics
STATS 390 SS
Assignment 3
Due: 9 February 2009
Please answer all questions. Remember this assignment is worth 10%. Make sure that you place
all answers and output into a word document and store in a safe area till finished.
1.
[
34 marks
]
Regression and DIC
The data set provided contains variables
x
1
, x
2
, x
3
and
y
in a file called
regress
data.txt
the model
file is called
regress
model.txt
. The object of this question is for you to construct different models
by taking different
x
variables, running each model and checking the
DIC
so that an appreciation
of model checking and
DIC
is made.
model
{
for (i in 1:100) {
y[i] ~ dnorm(..., tau)
mu[i] < beta0+beta1*(x1[i]mean(x1[]))+beta2*(x2[i]mean(x2[]))
+beta3*(x3[i]mean(x3[]))
}
tau ~ dgamma(0.001,0.001)
sigma < 1/sqrt(...)
beta0 ~ dnorm(0,1.0E6)
beta1 ~ dnorm(0,1.0E6)
beta2 ~ dnorm(0,1.0E6)
beta3 ~ dnorm(0,1.0E6)
}
(a) [2 mark(s)] If
y
i
=
μ
i
+
epsilon1
i
where
epsilon1
i
∼
N
(0
, τ
) then fill in the gaps
y[i]
∼
dnorm(...,...)
(b) [2 mark(s)] Fill in the two gaps in the above model.
(c) [2 mark(s)] What type of priors are assigned?
(d) [1 mark(s)] Why has the mean of the x’s been subtracted in the line that defines mu[i]?
(e) [3 mark(s)] Make suitable inits and run 3 chains using
WinBUGS
only (no
R
), check conver
gence with the
bgr
plot. Paste the final
bgr
plot into your answers once you are satisfied that
the distribution is stationary. Explain what the three different lines are and how they indicate
convergence.
STATS 390 SS
Assignment 3
Page 1 of 7
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
(f) [8 mark(s)] In Table 1 there are 4 models made up of different combinations of x’s. Run these
as above by changing the model file, for example to make model 2 just replace the beta3 prior
with
beta3<0
. Copy and fill in Table 1 in your answers.
Model
xvariables
pD
DIC
1
x
1
, x
2
, x
3
2
x
1
, x
2
3
x
2
, x
3
4
x
3
, x
1
Table 1:
DIC
checks on 4 Models
(g) [8 mark(s)] Use
R2WinBUGS
to run model 1 and put the output into an
R
object called
regress.sim
. Print and plot the object pasting the output into your answers along with the
bugs() command you used.
(h) [8 mark(s)] Alter the model file
regress
model.txt
by placing an informative prior on
beta1
i.e use
beta1
∼
dnorm(0,16)
(make sure the rest of the code is for
Model 1
) and use
debug=T
in the
bugs()
command.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '09
 renate
 Statistics, Regression Analysis, Prediction interval, DIC

Click to edit the document details