Confidence interval for $n$ of $X$~Bin$(n,0.3)$

54 Views Asked by At

I want to calculate a 90% confidence interval for $n$ (from $X$~Bin$(n,0.3)$) where the number of successes is known ($x=12$). I have found the smallest $n$ so that $P(X \le 12)\le 0.05$ is 61 and the largest $n$ so that $P(X \ge 12)\le 0.05$ is 25. However I can't find any examples online or in my textbook that construct CIs for $n$, only ones that do so for $p$ so I am a bit lost on where to go from here. Any hints would be greatly appreciated.

Update: I think I must use some pivot variable. For example, I know that $0.9 = P(-1.64 \le N(0,1) \le 1.96)$. Also, for large $n$, $X$~Bin$(n,p)$ has an approximate $N(np, np(1-p))$ distribution. If I let $\hat n=\frac{X}{p}$ denote the estimator of $n$, then $\hat n$ has an approximate $N(n, \frac{n(1-n)}{p})$ distribution (although I'm not 100% sure about this latter part). Then, I should be able to say $\frac{\hat n -n}{\sqrt{n(1-n)/p}}$~$N(0,1)$ and so I can substitute this into my first equation and get: $$0.9 = P(-1.64 \le \frac{\hat n -n}{\sqrt{n(1-n)/p}} \le 1.96)$$ and then rearrange for $\hat n$ by itself in the middle of the inequality. My only concern is that $\hat n$ does not an approximate $N(n, \frac{n(1-n)}{p})$ distribution rendering this incorrect. Does anyone have any ideas?

Update 2: Just realised the $n(1-n)$ will be negative (since $n \ge 12$) and so we will get an imaginary number in the square root, thus my proposed solution is wrong. Back to square one :(

2

There are 2 best solutions below

0
On

With n large enough (here $n$ looks like around $\frac{12}{0.3}=40$, so far so good) you can approximate

$$Bin(n;0.3)\approx N(0.3n;0.21n)$$

Thus your interval becomes

$$\Bigg| \frac{12-0.3n}{\sqrt{0.21n}}\Bigg|\leq 1.64$$

Solving this double inequality (it's an easy quadratic inequality) it results to me

$$[27;59]$$


I think that this post can be useful for your reasoning

0
On

When $n$ is unknown for IID Bernoulli trials, then an appropriate inferential model would be negative binomial: Let $N \sim \operatorname{NegativeBinomial}(X = 12, p = 0.3)$ with PMF $$\Pr[N = n \mid X, p ] = \binom{n-1}{r-1} p^X (1-p)^{n-X}, \quad n \in \{X, X+1, X+2, \ldots \}.$$ Then we can construct a two-sided, equal-tailed, exact confidence interval for $n$ as follows. For an overall confidence level of $100(1-\alpha)\%$, the lower confidence limit $L$ is the largest $L$ such that $$\Pr[N < L \mid X = 12, p = 0.3] \le \alpha/2.$$ For $\alpha = 0.1$ and a $90\%$ confidence interval, $L = 26$, since $\Pr[N < 26 \mid X = 12, p = 0.3] \approx 0.0442465$ but $L = 27$ exceeds $0.05$. For the upper confidence limit $U$, we similarly solve $$\Pr[N > U \mid X = 12, p = 0.3] = \alpha/2$$ to obtain $U = 57$, since $\Pr[N > 57 \mid X = 12, p = 0.3] \approx 0.0486239$ but $U = 56$ exceeds $0.05$. Therefore your equal-tailed (to the extent possible for a discrete parameter) interval is $N \in [26, 57]$.

Again, this is a calculation for an exact interval--"exact" in this case meaning it is not based on any asymptotic approximations. The coverage probability strictly exceeds the nominal confidence level.