Calculate the credible interval for posterior distribution ~ N(69.07,0.53^2)

1.1k Views Asked by At

I'm not really sure as to how to calculate the credible interval for this posterior distribution I'm given

~ N(69.07, 0.53^2)

And I need to find the probability of the interval, of length 1, which has the highest probability.

I know this interval is about to average ie 69.07+-0.5 but I don't know how to calculate the probability of this interval

1

There are 1 best solutions below

6
On

Your posterior distribution is $\mathsf{Norm}(\mu = 69.07, \sigma=0.53).$ Finding the interval $(L_{ci}, U_{ci})$ of length $U_{ci}-L_{ci} = 1$ that contains the greatest probability under the posterior PDF requires some sort of computation.

As you say, intuitively this interval will be about $69.07 \pm 0.5$ because that is were the density function is highest.

Not knowing the kinds of computations with which you are familiar, I will do a 'grid search' in R statistical software to illustrate the idea. This is a brute-force method that looks at all 'reasonable' intervals of length $1$ (30,001 intervals with endpoints rounded to four places), finds the probability of each, and picks the one with the largest probability. It confirms that the interval $(68.57, 69.57)$ is indeed the correct one. It has about probability about 65.5%. [One can prove that this is the shortest 65.5% posterior credible interval.]

Here is some R code:

 L = seq(67,70, by = 0.0001);  U = L+1
 pr = pnorm(L+1, 69.07, .53) - pnorm(L, 69.07, .53)
 L.ci = L[pr == max(pr)]  # lower end of interval (length 1) with largest probability
 U.ci = L.ci+1;  L.ci;  U.ci;  max(pr)
 ## 68.57
 ## 69.57
 ## 0.6545217

 curve(dnorm(x, 69.07, .53), 67, 71, lwd=2,  ylab="PDF", main="Posterior Distribution")
 abline(h = 0, col="green2"); abline(v=c(L.ci,U.ci), col="blue")
 abline(h = dnorm(L.ci, 69.07, .53), col="red")

The figure below (made with the last three lines of code) shows the interval boundaries, and illustrates that the the interval 'uses' the largest values of the posterior density.

enter image description here

Note: It is common to use 'probability symmetric' intervals--especially with symmetrical (or nearly-symmetric) posterior distributions. Below is R code to find a 95% credible interval $(68.03, 70.11)$ that cuts probability 2.5% from each tail of the posterior distribution.

 qnorm(c(.025,.975), 69.07, .53)
 ## 68.03122 70.10878