6
$\begingroup$

I have a situation that is analogous to someone starting with a bag of 150 red and blue marbles, and, sampling randomly without replacement, drawing 37 red marbles and 3 blue marbles. What is a formula that would give confidence intervals for the true proportions that are both realistic and not overly large? How could I derive it? Ideally, it should give a confidence interval of non-zero radius even if we were to draw 40 red marbles out of 40.

$\endgroup$
  • 1
    $\begingroup$ Do you know for sure that you are starting with 150 marbles total? And that the bag is well-mixed? $\endgroup$ – EdM Sep 6 '19 at 16:02
  • 1
    $\begingroup$ Perhaps see JASA. $\endgroup$ – BruceET Sep 6 '19 at 20:46
  • $\begingroup$ Similar Question, but no answer. $\endgroup$ – BruceET Sep 7 '19 at 1:10
  • $\begingroup$ Yes, there are exactly 150 marbles, and we are sampling perfectly randomly. $\endgroup$ – Zorgoth Sep 8 '19 at 12:15
4
$\begingroup$

Judging from its abstract, the JASA article by Weizhen Wang linked in my comment, gives a method to get (nearly) exact hypergeometric confidence confidence intervals. Perhaps a more easily computed style of CI, based on a normal approximation to the hypergeometric distribution, will suffice for your purposes.

Main example: Suppose we know there are $T$ marbles in the urn, of which we withdraw $n = 40$ without replacement, observing $x = 37$ red marbles in our sample. We wish to estimate the number $R$ of red marbles in the urn.

A Wald-style asymptotic CI would use $p = x/n$ to estimate the proportion of red marbles, thus estimating that the number of red balls in the urn is $R = pT$ (rounded to an integer). Such an interval would degenerate to a point estimate for $x = 0$ of $x = n,$ which you say you want to avoid. [Note: Our goal is to estimate the integer parameter $R.$ So a 'point' CI is not necessarily absurd.]

For binomial CIs, the Agresti-Coull style of interval 'shrinks' the point estimate of the binomial success probability $\theta$ towards $1/2$ to provide an interval that does not degenerate to points for extreme observations and has more accurate coverage probability than Wald CIs. They use $\hat \theta = \frac{x+2}{n+4},$ but arguments can be made that $\hat \theta = \frac{x+1}{n+2}$ might also be used. Accordingly, I suggest the estimate $p = \frac{x+1}{n+2}$ as an estimate for hypergeometric $p$ in your problem.

Proposed interval from normal approximation. The R code below computes the interval $p \pm 1.96 \sqrt{\frac{cp(1-p)}{n+2}},$ with $p = \frac{x+1}{n+2}$ and the 'finite population correction' $c = \frac{T-n}{T-1}.$ In terms of the number $R$ of red marbles, the result is $[125, 147]$. (I'm using R statistical software to do the calculations; a calculator would suffice.)

t = 150 # marb in urn
x = 37  # red in samp
n = 40  # marb in samp
p = (x+1)/(n+2)
cor = (t-n)/(t-1)
me = 1.96*sqrt(cor*p*(1-p)/(n+4))
lcl = p - me;  ucl = p + me
lcl; ucl
[1] 0.8302363
[1] 0.9792875

LCL = max(0, round(t*lcl))
UCL = min(t, round(t*ucl))
c(LCL, UCL)
[1] 125 147

For $x = 0, 20,$ and $40,$ this style of CI gives 95% interval estimates $[0,15],\, [56,94],$ and $[135,150],$ respectively. The interval for $x = 20$ may look excessively long, but I believe it is reasonable. First a roughly corresponding Agresti-Coull binomial 95% CI $(0.352, 0.648)$ for 20 observed successes in 40 trials.

The "general method." More directly, the so-called 'general method' for confidence intervals can be (roughly) applied to the hypergeometric problem as shown below. [I say roughly, because some minor fussing with the discrete nature of the hypergeometric distribution remains unresolved.]

r = 0:150
h1 = qhyper(.025, r, 150-r, 40)
h2 = qhyper(.975, r, 150-r, 40)
plot(r, h1, type="s", ylab="Red Obs", xlab="Red Est")
 lines(r, h2, type="s")
  abline(h = 20, col="red")
  abline(v=c(56,94), col="blue")

enter image description here

For $x = 20,$ the 95% CI from the proposed modification of the Wald interval agrees pretty well with the CI from the general method. Below the graph for the general method shows lines corresponding to our main example with $x = 37.$

enter image description here

Furthermore, agreement for the extreme cases $(x = 0$ or $x = n)$ is not perfect, but also pretty good. (Even for large $T,$ the normal approximation is less accurate for $R$ near $0$ or $T.$ Maybe you can check the extreme cases for yourself from a printout of the figure.)

Unresolved. An unresolved issue with the general method in this case is that it is not possible in general to get 95% CIs by 'cutting exactly 2.5% from each tail of the distribution' because the hypergeometric distribution is discrete. The usual approach is to start by getting 'optimal' one-sided CIs, and from them to get two-sided CIs with approximately 95% coverage--as near as possible to 95% without going below. (To use a normal approximation is essentially to ignore the discreteness issue, not to resolve it.)

I do not see how to make sense of getting CIs for the number of red marbles without knowing the total number of marbles. If $n < 0.1T,$ it might be argued that binomial CIs should be used to give proportions of red marbles.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.