Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Computing with a nonconjugate single-parameter model: suppose y1, . . . , y5 are independentsamples from a Cauchy distribution with unknown center ? and known scale 1:p(yi|?) ? 1/(1 + (yi - ?)2)....

1 answer below »
Computing with a nonconjugate single-parameter model: suppose y1, . . . , y5 are independentsamples from a Cauchy distribution with unknown center ? and known scale 1:p(yi|?) ? 1/(1 + (yi - ?)2). Assume, for simplicity, that the prior distribution for ? isuniform on [0, 100]. Given the observations (y1, . . . , y5) = (43, 44, 45, 46.5, 47.5):(a) Compute the unnormalized posterior density function, p(?)p(y|?), on a grid of points? = 0, 1m, 2m, . . . , 100, for some large integer m. Using the grid approximation, computeand plot the normalized posterior density function, p(?|y), as a function of ?.(b) Sample 1000 draws of ? from the posterior density and plot a histogram of the draws.(c) Use the 1000 samples of ? to obtain 1000 samples from the predictive distribution ofa future observation, y6, and plot a histogram of the predictive draws.
Answered Same Day Dec 25, 2021

Solution

Robert answered on Dec 25 2021
121 Votes
Solution:
(a). Compute the unnormalised posterior density function, p(θ)p(y|θ), on a grid of points θ =
0, 1/m , 2/m , . . . , 100 for some large integer m. Using the grid approximation, compute and
plot the normalized posterior density function, p(θ|y), as a function of θ.
To plot in the MATLAB following code is used:
# Sampling distribution
dist <- function (y, th){
dist0 <- NULL
for (I in 1 : length(th))
dist0 <- c(dist0, prod( dcauchy (y, th[i])))
dist0}
#Data
y <- c(43,44,45,46.5,47.5)...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here