001 n100 sumy 57 ptheta duniftheta 0 1 or you can

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 6 9.50 × 10−17 0.304 1.0 0.675 0.5 0.000 (d) Suppose θ ∼ Uniform(0, 1) ≡ Beta(1, 1), i.e., p(θ) = 1, 0 ≤ θ ≤ 1. We can plot p(θ) × p( ￿n i=1 Yi = 57|θ) as a function of θ using the following R code: theta = seq(0, 1, 0.001); n=100; sumy = 57 ptheta = dunif(theta, 0, 1) # or you can use ptheta = dbeta(theta, 1, 1) psumy = dbinom(sumy, n, theta) plot(theta, ptheta*psumy, type="l", xlab=expression(theta), ylab = expression(paste("p(",theta,")*p(",sum(y),"=57|",theta,")"))) (e) The posterior density is given by θ|y ∼ Beta(1 + 57, 1 + 100 − 57) ≡ Beta(58, 44). The following R code can be used to obtain a plot of the posterior density: curve(dbeta(x, 58, 44), from=0, to=1, xlab=expression(theta), ylab=expression(paste("p(",theta,"|",sum(y),"=57)"))) ￿ In parts (b) and (c), θ is assumed to take a set of discrete values. The plot of p( i Yi = y |θ) in (b) can be viewed as the likelihood function of θ over the discrete values that θ can take. Alternatively, since p(θ) is constant, it can be viewed as the numerator of the posterior ￿ distribution of θ, i.e., the un-normalized function. In (c), p(θ| i Yi = 57) corresponds to the normalized posterior density function of θ over the discrete values θ is assumed to take; ￿ ￿ j p( θ = j | i Yi = 57) = 1. These plots suggest that the most likely value of θ is 0.6. In parts(d) and (e), θ is viewed as a continuous random variable on the interval [0, 1]. The plot in (d) corresponds to the numerator of the posterior de...
View Full Document

Ask a homework question - tutors are online