Question: 4 Suppose (|) is the posterior distribution for some parameter , and that it follows a Beta distribution with parameters and ; we will refer

4 Suppose (|) is the posterior distribution for some parameter , and that it follows a Beta distribution with parameters and ; we will refer to these as shape parameters 1 and 2, to avoid confusion with as the confidence level. Your task is to determine the High Posterior Density (HPD) Credible Interval. Write an R function, hpd(sh1, sh2, alpha), that takes as its first two arguments the shape parameters for the Beta distribution, and the third defines the 1 credible level; this function should return a vector of length 2, giving the lower and upper bounds of the credible interval, respectively. Recall that you must find >0 such that (|)=1 , where the region is everywhere the posterior density exceeds : ={:(|)} . Once you've found , the upper and lower bounds of the region give the interval (,) . You will need to determine this interval, (,) , computationally. The general algorithm follows as: Given the shape parameters, get the density function for the Beta distribution Start with some , find the corresponding interval (,) , and calculate the area under the curve. If the area under the curve is less than 1 , decrease by

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!