# Confidence Interval on the Geometric Distribution Expected Value?

If we are told that some random variable $X$ follows a Geometric distribution, with $Pr(X =1) = p$. The sample has observed values between $1$ and $N$.

We know that $E(X) = 1/p$

My question is: Can we construct a confidence interval for the mean?

• Is it possible that the $p$ in your question the estimate of the parameter based on the sample? Commented Oct 7, 2015 at 3:34

If one knows the population parameter of a geometric, one of course knows the population mean exactly, so a confidence interval for that would be of zero width.

Assuming we only have sample information, we can construct a confidence interval for the population mean of a geometric random variable.

Since your lowest value is 1, I assume we're dealing with the "number of trials" form of the geometric.

Large sample: The population mean of a Geometric(p) variate is $1/p$; the variance is $(1-p)/p^2$, so the variance of a sample mean will be $(1-p)/(np^2)$. The statistic $Q_A=\frac{\bar{X}-1/p}{\sqrt{(1-p)/(np^2)}}\:$ (*) will be asymptotically standard normal. A large sample interval for $p$ could be "backed out" from that. Which is to say, we can make an interval for $Q_A$, and then find the values of $p$ which make $Q_A$ satisfy that condition (of being in the interval).

e.g. if $\bar{x}=3.14$ and $n=100$ I get an asymptotic 95% interval for $p$ to be $(0.265, 0.368)$ (just by seeing which values for $p$ make that expression for $Q_A$ above stay between -1.96 and 1.96). Hence an interval for $1/p$ (the population mean) would be $(1/0.368,1/0.265)$, or $(2.72,3.77)$. Note that this is not an interval that's symmetric about the usual point estimate.

A more sophisticated approach (in the sense of letting you more directly get the bounds) would attempt to solve the expression for $p^{\:(\dagger)}\:$ (using $Z_\frac{\alpha}{2}$ in place of 1.96), I think this just gives a quadratic in $p$, so it's probably not onerous, but if you only need to do it once, hardly worthwhile.

$\dagger$ Or, essentially as easily, one could directly rewrite the expression for $\frac{1}{p}$ and produce an interval for the population mean more directly.

Edit: Here it is for completeness' sake. Define $\bar x$ to be the sample mean, $n$ the sample size (the number of geometric(p) values available), and $z$ to be the critical $Z_{\frac{\alpha}{2}}$ value. Further, define:

$A=2(1-\frac{z^2}{n})$

$B=2\bar{x}-\frac{z^2}{n}$

$m=\frac{B}{A}\quad$ (the midpoint)

$h=\sqrt{m^2-2\bar{x}/A}\quad$ (the half-width)

then an approximate $1-\alpha$ interval for $\mu=\frac{1}{p}$ is $(m-h,m+h)$.

In very large samples, one might make a further approximation and substitute $1/\bar{X}$ for $p$ in the denominator of the formula for $Q_A$, which would yield a simpler - and now symmetric - interval for $1/p$. On the data used above I get $(2.63,3.65)$ for that interval.

The fact that there's a fairly big difference from the previous interval suggests that the sample size of n=100 probably wasn't quite large enough in this case to apply the faster-but-even-more-approximate approach. Indeed, the fairly strong lack of symmetry of the earlier interval about 3.14 suggests the same thing.

Small sample: You can probably also do something with the small sample case. e.g. one approach might try to use pivotal quantities, but I haven't tried to check yet if one can construct a suitable pivot in this case. There might not be one.

Pondering a little further, it seems to me that there may be an approach that is similar to the way the chi-squared distribution can be used to give an interval for a Poisson parameter. I believe there's a similar relationship between an incomplete beta integral and the negative binomial (of which the geometric is a special case), so it should be possible to get an interval that way. In particular it suggests that perhaps $F$ tables (or equivalent functions in some package) could then be used to get limits on an interval for $p$, and hence for $\mu=1/p$.

• What do you mean by the statistics will be {formula above }? What is that formula equal to? Also, what if there is no data - and the p value its an assumption? Commented Oct 7, 2015 at 2:21
• The expression referred to is the statistic that I state is asymptotically standard normal, that standardized $\bar X$ (naturally enough, since I am comparing with $\pm$1.96, the bounds of a symmetric 95% interval for a standard normal variate). If there's no data, you can't have a confidence interval, which is what your question asks for. Commented Oct 7, 2015 at 2:25
• Are you saying: Commented Oct 7, 2015 at 2:38
• \begin{gather*} \mbox{Mean Conf. Limit} = \left(\frac{1}{p}\right)\pm Z_{0.95}\cdot \frac{\bar{X}-\left(\frac{1}{p}\right)}{\sqrt{\frac{(1-p)}{(np^{2})}}} \end{gather*} Commented Oct 7, 2015 at 2:38
• Definitely not. I've fixed some omissions and made some clarifications which might help a little. Taking the simple-minded approach, one computes the entire expression $\frac{\bar{X}-\frac{1}{p}}{\sqrt{\frac{1-p}{np^2} } }$ for various values of $p$ in (0,1), until one finds all the possible values for $p$ that lie inside (-1.96,1.96). If that's a single range of $p$ that's well inside (0,1) (and it better be, or the approximation is sure to be bad) then one inverts the endpoints of that to get an interval for $\mu=\frac{1}{p}$. A sophisticated approach would attempt to solve for $p$ directly Commented Oct 7, 2015 at 2:41

Same as mtauraso, I don't have 50 rep to comment on the above excellent answer by Glen_b.

I actually had to do this for one of my models, and I ended up doing this for p, which I just realized you did for 1/p. Here's the derivations anyway.

Define $$\bar x$$ to be the sample mean, $$n$$ the sample size (the number of geometric(p) values available), and $$z$$ to be the critical $$Z_{\frac{\alpha}{2}}$$ value.

Then, we have,
$$z=\frac{\bar{X}-1/p}{\sqrt{(1-p)/(np^2)}}\: \implies z^2=\frac{(\bar{X}-1/p)^2}{(1-p)/(np^2)}\:$$

$$\Rightarrow p^2\bar{X}^2-p(2\bar{X}-z^2/n)+(1-z^2/n)\:=0$$

So, if we define: $$A=2\bar{x}$$; $$B=2\bar{x}-\frac{z^2}{n}$$ ; $$C=(1-\frac{z^2}{n})$$

then, the rest follows as -

$$m=\frac{B}{A}\quad$$ (the midpoint)

$$h=\sqrt{m^2-2C/A}\quad$$ (the half-width)

then an approximate $$1-\alpha$$ interval for $$p$$ is $$(m-h,m+h)$$.

For getting at $$1-\alpha$$ interval for $$\mu=\frac{1}{p}$$:

$$\Rightarrow 1/p^2(1-z^2/n)-1/p(2\bar{X}-z^2/n)+\bar{X}^2\:=0$$

And by defining how Glen_b defined, we get:

$$A=2(1-\frac{z^2}{n})$$; $$B=2\bar{x}-\frac{z^2}{n}$$

$$m=\frac{B}{A}\quad$$ (the midpoint)

$$h=\sqrt{m^2-2\bar{x}/A}\quad$$ (the half-width)

then an approximate $$1-\alpha$$ interval for $$\mu=\frac{1}{p}$$ is $$(m-h,m+h)$$.

I don't have 50 rep otherwise this would be a comment on Glen_b's excellent answer above, which made confidence intervals on the geometric distribution make sense to me. I'm happy to remove this if its in violation of site norms/rules, but the result I worked out may be helpful for other folks coming upon this answer for the first time.

I'm attempting to use the worked out version of the confidence interval at the bottom of the answer with $\bar{x}=3.14$ and $n=100$ attempting to replicate the $(0.265, 0.368)$ confidence interval for p. I don't get values that make sense for the (m+h,m-h) confidence interval on $\bar{x}$, furthermore my confidence interval calculated via the rewritten form below doesn't have properties I would expect. I don't see $h->0$ as $n->\infty$.

I agree that the inequality involving $Q_A$ and $Z_{a/2}$ results in a quadratic relation for $p$ which can be solved for. When I solve that relation I get:

$$m = \Big(\frac{1}{\bar{x}}-\frac{z^2}{2n\bar{x}^2}\Big)\\ h = \frac{z\sqrt{z^2+4n\bar{x}(\bar{x}-1)}}{2n\bar{x}^2}$$

My confidence interval for $p$ is $(m-h,m+h)$, and the rest of the setup the same. I get a confidence interval of $(0.265,0.368)$ for the example above and the asymptotic behavior of $h$ as $n$ increases is what I would expect.