# Showing $\big( \frac{a}{n\bar{x}}, \frac{b}{n\bar{x}} \big)$ is an exact confidence interval for a gamma distribution

Let $X_1,\ldots,X_n$ be exponentially distributed with parameter $\lambda$ This implies that $Y=\sum_{i=1}^nX_i$ has a gamma distribution with parameters $(\lambda,n)$

Can anyone help me show that $$\left( \frac{a}{n\bar{x}}, \frac{b}{n\bar{x}} \right)$$ Is an exact $95$% central confidence interval for $\lambda$ if

$$\int_0^a \frac{y^{n-1}e^{-y}\;dy}{\Gamma(n)}= \int_b^\infty \frac{y^{n-1}e^{-y}\;dy}{\Gamma(n)}= 0.025$$

Here is what I have so far. Basically i've been trying to construct anything to help use those given integrals

$$P\left(\frac{a}{n\bar{x}}<Y<\frac{b}{n\bar{x}}\right)=P\left(Y<\frac{a}{n\bar{x}}\right)+P\left(Y<\frac{b}{n\bar{x}}\right)-1$$

$$=\lambda^{-n}\int_0^\frac{a}{n\bar{x}} \frac{y^{n-1}e^{-y/\lambda}\;dy}{\Gamma(n)}+\lambda^{-n}\int_0^\frac{b}{n\bar{x}} \frac{y^{n-1}e^{-y/\lambda}\;dy}{\Gamma(n)}-1$$

Which is where I get stuck as this doesn't really look salvagable. Any help here would be greatly appreciated!

-

You wrote $$P\left(\frac{a}{n\bar{x}}<Y<\frac{b}{n\bar{x}}\right).$$ But what you need is $$P\left(\frac{a}{n\bar{X}}<\lambda<\frac{b}{n\bar{X}}\right) = 0.95.\tag{1}$$ I've set $\bar X$ in capital since it's a random variable. One must remember what is random and what is not random in this kind of problem. To say that $a/(n\bar X)$ is "random" in effect means that if you take another sample, the value of that expression will change. $\lambda$ on the other hand is not random since it will remain the same if another sample is taken.

(1) is equivalent to $$P\left(\frac a\lambda < n\bar X < \frac b\lambda\right) = 0.95,$$ or $$P\left(\frac a\lambda < Y < \frac b\lambda\right) = 0.95 \tag{2}$$ Here is an ambiguity in the question: does "exponential with parameter $\lambda$" mean having density proportional to $y\mapsto e^{-\lambda y}$ or does it mean $y\mapsto e^{-y/\lambda}$? Since (2) is equivalent to $$P\left(a < \lambda Y < b\right) = 0.95,$$ I take it to mean $\lambda Y$ has a gamma distribution with parameter $1$ in place of $\lambda$, so the density of the exponential is proportional to $y\mapsto e^{-\lambda y}$, i.e. $\lambda$ is an intensity parameter rather than a scale parameter.

So $$P(X_i > c) = \int_c^\infty e^{-\lambda u} (\lambda \; du) = \int_{\lambda c}^\infty e^{-y}\;dy,$$ and so $$P(Y>c) = (X_1 + \cdots + X_n > c) = \int_{\lambda c}^\infty \frac{y^{n-1} e^{-y}}{\Gamma(n)} \; dy.$$

Finally we have $$P\left( \frac a\lambda < Y < \frac b\lambda \right) = \int_{\lambda(a/\lambda)}^{\lambda(a/\lambda)} \cdots\cdots = \int_a^b \cdots\cdots.$$

-
Thank you this is incredibly helpful! Thank you for being slow and clear in your answer, it made it very easy to understand – Freeman Feb 8 '12 at 13:01

Assuming that $E[X_i] = \lambda^{-1}$, $Y = \sum_i X_i = n\bar{X}$ is a Gamma random variable with mean $n\lambda^{-1}$ and density function $$f_Y(y) = \lambda \frac{(\lambda y)^{n-1}}{\Gamma(n)}\exp(-\lambda y)\mathbf{1}_{(0,\infty)}.$$ Define $\alpha$ and $\beta$ as the solutions to $F_Y(\alpha)=0.025$ and $F_Y(\beta) = 0.975$ so that $$P\{\alpha \leq Y \leq \beta\} = F_Y(\beta) - F_Y(\alpha) = 0.95$$ and note that $$F_Y(\alpha) = \int_0^{\alpha} \lambda \frac{(\lambda y)^{n-1}}{\Gamma(n)}\exp(-\lambda y) \mathrm dy = \int_0^{\lambda\alpha} \frac{t^{n-1}}{\Gamma(n)}\exp(-t) \mathrm dt$$ so that $a = \lambda \alpha$ and similarly $b = \lambda \beta$. Verify for yourself that the following bounds hold: $$\alpha < n\lambda^{-1} < \beta; ~~ a < n < b.$$

Now suppose that the value of $\lambda$ is unknown. We observe the values of the $X_i$, compute the value of $Y = \sum_i X_i = n\bar{X}$, and have $95\%$ confidence that $Y$ is in the interval $[\alpha, \beta]$ whose end-points are, unfortunately, unknown to us. But, if we assume that the known value of $Y$ is at the endpoint $\alpha = a/\lambda$, then we are in effect estimating that the unknown value of $\lambda$ is $a/Y = a/n\bar{X}$ while if we assume that $Y$ is at the other endpoint $\beta = b/\lambda$, then we are in effect estimating that the unknown value of $\lambda$ is $b/Y = b/n\bar{X}$. More generally, if we simply assume that $Y$ has taken on the expected value $n\lambda^{-1}$, we in effect estimate the value of $\lambda$ as $$\hat{\lambda} = \frac{n}{Y} = \frac{n}{X_1 + X_2 + \cdots + X_n}$$ which will be readily recognized as the maximum-likelihood estimate of the parameter $\lambda$ of an exponential random variable $X$ based on $n$ independent observations of $X$. But now we also have a $95\%$ confidence interval for our estimate.

If the sample mean is $\bar{X}$, then $\left(\frac{a}{n\bar{X}},\frac{b}{n\bar{X}}\right)$ is an exact $95\%$ confidence interval for the unknown parameter $\lambda$.

-
Thank you so much for this very detailed answer, it was very helpful. I feel I know understand this – Freeman Feb 8 '12 at 13:03