Question: 8. (a) Generate an artificial data set of size N D 100 for the Normal linear regression model with an intercept and one other explanatory
8.
(a) Generate an artificial data set of size N D 100 for the Normal linear regression model with an intercept and one other explanatory variable.
Set the intercept to 0, the slope coefficient to 1:0 and h D 1:0. Generate the explanatory variable by taking random draws from the U.0; 1/
distribution (see Chapter 2, Exercise 1 for more information on how to artificially generate data sets).
(b) Calculate the posterior mean and standard deviation for this data set using a Normal-Gamma prior with þ D .0; 1/0; V D I2; s52 D 1; ¹ D 1.
(c) Graph the posterior of þ2.
(d) Calculate the Bayes factor comparing the model M1 : þ2 D 0 with M2 : þ2 6D 0.
(e) Plot the predictive distribution for a future observation with x2 D 0:5.
(f) Carry out a prior sensitivity analysis by setting V D cI2 and repeating parts (b),
(d) and
(e) for values of c D 0:01; 1:0; 100:0; 1 ð 106. How sensitive is the posterior to changes in prior information? How sensitive is the Bayes factor? How sensitive is the predictive distribution?
(g) Calculate the posterior mean and standard deviation of þ using a noninformative prior.
(h) Calculate a 99% HPDI for þ2 using the noninformative prior and use it for investigating whether þ2 D 0. Compare your results with those of part (d).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
