# Derivation of bayesian confidence interval

How do you derive the expression for the $100(1-\alpha)$% bayesian confidence interval when working with the uniform distribution in the interval $[-\theta,\theta]$?

• This question needs more information: what exactly do you mean by "working with" a distribution? Confidence interval for what parameter? Based on what data? What prior distribution?
– whuber
Mar 26, 2011 at 22:37
• X follows a uniform distribution
– user3910
Mar 27, 2011 at 5:48
• find the CI for theta
– user3910
Mar 27, 2011 at 5:48
• the improper prior is used
– user3910
Mar 27, 2011 at 5:49
• 1. Do you have a sample set of data $\{ X_i \}$? 2. When you say "the improper prior is used", which one? Perhaps the one with density proportional to $1/\theta$? Or perhaps something else? 3. Which credible interval (not confidence interval) do you want? Wikipedia offers three, though I don't think the third is particularly useful. Mar 28, 2011 at 0:11

So you have a density of:

$$p(X_i|\theta)=\frac{1}{2\theta}\;\;\;\; X_i\in[-\theta,\theta]$$

Now this is what is called a scale density, and $\theta$ is a scale parameter, just like the standard deviation in a normal distribution.

Now to do a Bayesian CI you require a prior distribution for $\theta$. Because $\theta$ is a scale parameter, the prior describing complete initial ignorance is given by:

$$p(\theta|\theta_L,\theta_U) = \frac{1}{\theta [log(\frac{\theta_U}{\theta_L})]} \;\;\; \theta\in[\theta_L,\theta_U]$$

In your comment, you state that "the improper prior is to be used" so this means that you take the upper limit $\theta_U\rightarrow \infty$ and the lower limit $\theta_L\rightarrow 0$. But this is in principle, to be done at the end of the calculation, and not at the start. This is to ensure that you don't have an "infinity" floating around in your results, making them arbitrary. If the limit does not exist, then "probability theory" is "telling you" that the actual bounds are important to your conclusion.

I assume you want to work this out for yourself, so the remainder just goes:

1. calculate the posterior (Note: I have used $s$ as a dummy variable to indicate that the denominator is independent of $\theta$). $$p(\theta|D,\theta_L,\theta_U)=\frac{p(\theta|\theta_L,\theta_U)\prod_{i=1}^{n}p(X_i|\theta)}{\int_{\theta_L}^{\theta_U}p(s|\theta_L,\theta_U)\prod_{i=1}^{n}p(X_i|s)ds}$$
2. Calculate calculate the lower bound $C_L$ and upper bound $C_U$ such that there is a $100(1-\alpha)$% probability that $C_L<\theta<C_U$. You can do this by solving for general limits $$\int_{C_L}^{C_U}p(\theta|D,L,U)d\theta=1-\alpha$$

This should give you enough of the "machinery" to go and solve the problem. However, if you need more details, I can post them.

The question is not totally clear, but I am going to assume that that you have an improper prior for $\theta$ proportional to $1/\theta$ and $n$ observed points $\{X_i\}$.

A sufficient statistic is $Y=\max_i |X_i|$, and you will have

$$Pr(Y \le y|\theta) = (y/\theta)^n \textrm{ if } 0 \le y \le \theta$$

so with density $p(y|\theta) = ny^{n-1}/\theta^n$.

So using Bayes' theorem you get

$$p(\theta|y) = \frac{ny^{n-1}/\theta^{n+1}}{\int_{\phi=y}^{\infty}ny^{n-1}/\phi^{n+1} \; d\phi} =\frac{n y^{n}}{\theta^{n+1}} \textrm{ if } \theta \ge y.$$

This is a decreasing function of $\theta$ and has an integral $Pr(\theta \le \theta_0|Y=y) = 1-(y/\theta_0)^{n}$.

So there are several credible intervals for $\theta$ given $Y=\max_i |X_i|$. The narrowest (highest density) $1-\alpha$ interval is $$\left[Y, \frac{Y}{\sqrt[n]{\alpha}}\right]$$ while the quantile centred interval is $$\left[\frac{Y}{\sqrt[n]{1-\frac{\alpha}{2}}}, \frac{Y}{\sqrt[n]{\frac{\alpha}{2}}}\right] .$$

• you forgot to multiply the likelihood by the prior (or you multiplied by $\frac{1}{y}$ instead), and your likelihood has $n\frac{y^{n-2}}{\theta^n}$, when you have just written the density as $n\frac{y^{n-1}}{\theta^{n}}$. your CI is based on $n-1$ observations, should replace $n-1\rightarrow n$ in your answer. (posterior should be $n\frac{y^n}{\theta^{n+1}}$ ) Mar 29, 2011 at 20:40
• @probabilityislogic: thank you - I had indeed used $\frac{1}{y}$ rather than $\frac{1}{\theta}$. Better now I hope. Mar 29, 2011 at 21:04