# Stat 432 Homework 7 solution

\$30.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

5/5 - (1 vote)

## Question 1 (Bayesian updates) [5 points]

Consider a simple normal model for the height y of students where y|θ ∼ N(θ, 16). Assume a conjugate prior
θ ∼ N(65, 36). We measure the height of two students and observe y1 = 68 and y2 = 72.

a. Find the posterior distribution of θ given {y1, y2} when the data come sequentially (i.e., we first observe
y1, we update our prior, then observe y2 and update our prior again).

b. Find the posterior distribution of θ given {y1, y2} when data come simultaneously (i.e., we update our
prior after observing both y1 and y2).

c. Plot the prior, the likelihood and all the different posterior distributions. Discuss your findings (just
one paragraph).

## Question 2 (Bayesian linear regression) [5 points]

Now we use the same Boston housig data to do a Bayesian linear regression.
data(Boston, package=”MASS”)
useLog = c(1,3,5,6,8,9,10,14)
Boston[,useLog] = log(Boston[,useLog])
Boston[,2] = Boston[,2] / 10
Boston[,7] = Boston[,7]^2.5 / 10^4
Boston[,11] = exp(0.4 * Boston[,11])/1000
Boston[,12] = Boston[,12] / 100
Boston[,13] = sqrt(Boston[,13])

Continuing with HW6 Q1 where we did ridge regression on a sequence of λ’s, now we do the Bayesian linear
regression with a sequence of priors for β ∼ Np+1(0,Λ0). The correspondence between Λ0 and λ can be found
on page 50 of lecture BayesRegLinReg.

You can either use a fixed σ
2
estimated from the data or give it a
prior similarly as the one on page 53. Compare the solutions between Frequentist (from HW6) and Bayesian.
You might consider the similar plot as on page 61.

## Extra-Credit Question [5 points]

Use the same Boston housig data to do a Bayesian lasso. Continuing with HW6 Q2 where we did lasso on a
sequence of λ’s, now we do the Bayesian lasso with a sequence priors that correspond to λ’s specified on page
58. Compare the solutions between Frequentist (from HW6) and Bayesian. You might consider the similar
plot as on page 61. Refer to the file on the repository included in rlab document BayesRegLinReg for help.