If we have a recorded percentage (statistic) on a population, if we take random samples we might not encounter the percentage till e.g. even we exhaust the population.
E.g. a box with $500000$ balls of which $25000$ ($5$%) of them are red and the rest are all white.
My question is what is min/max number of a sample to consider we will be able to see that $5$% of red balls we know exists in the larger population? And not specifically for $500000$ but any population larger than $50000$

  • 1
    $\begingroup$ Do you want the estimate to be exactly 5% or 5% with a margin of error? I.e. do you round? Because those are quite different problems. Increasing your population size might actually decrease the chance that you hit those 5% exactly $\endgroup$
    – Felix B.
    Commented Apr 6, 2023 at 8:18
  • $\begingroup$ @FelixB. If we know the margin of error then that should be ok too. I didn't understand how increasing the population size would decrease the chance $\endgroup$
    – Jim
    Commented Apr 6, 2023 at 8:19
  • $\begingroup$ okay that sounds like you want to have concentration inequalities - I'll type up an answer $\endgroup$
    – Felix B.
    Commented Apr 6, 2023 at 8:21

1 Answer 1


So you are interested in confidence intervals for a sample average. You probably know the strong law of large numbers for identically distributed random variables

$$ \newcommand{\E}{\mathbb{E}} $$ $$ \bar{X}_n := \frac1n\sum_{i=1}^n X_i \to \mathbb{E}[X_1] $$

Now if you pick items from a population at random, then you sample that population in an iid fashion. If you ask wether item $X_i$ has a certain property, then you are asking whether the indicator $1_{X_i \in A}$ of $X_i\in A$ where $A$ describes the property, is one. Now the $Y_i = 1_{X_i \in A}$ are also independent identically distributed random variables. So the strong law of large numbers applies: $$\begin{aligned} \text{average share in sample} &=\frac{\#\{X_i \in A: i=1,\dots, n\}}{n} \\ &= \frac1n\sum_{i=1}^n 1_{X_i\in A} \\ &\to \mathbb{E}[1_{X_1 \in A}] = \Pr(X_1 \in A) = 0.05 \end{aligned} $$

So the question you are really asking is, how far away will the average $\bar{Y}_n$ be from the expectation $\E[Y_1]$ for a given sample size $n$. Notice that the expectation of the average is the same $\E[\bar{Y}_n] = \E[Y_1]$. If you want to allow a margin of error of $\epsilon$, we want to bound the probability, that we exceed this margin

$$ \Pr(|\bar{Y}_n - \E[\bar{Y}_n]| > \epsilon) $$ These types of inequalities are knwon as Concentration Inequalities. The least sophisticated one is perhaps Chebyshev's Inequality $$ \Pr(|\bar{Y}_n - \E[\bar{Y}_n]| > \epsilon) \le \frac{\mathbb{V}(\bar{Y}_n)}{\epsilon^2} = \frac{\mathbb{V}(Y_1)}{n\epsilon^2} $$

with variance $\mathbb{V}(Y_1)$ of $Y_1$. Since we know that $Y_i$ is bernoulli $\text{Ber}(p)$ with $p=\Pr(X_1\in A)$ distributed, we have $$ \mathbb{V}(Y_1) = p(1-p) = 0.05(1-0.05) = 0.0475 $$ At the same time we could do much better. As bernoulli random variables are bounded, we can apply the Chernoff bound for example.

If you have a large sample, you could argue that $\bar{Y}_n$ is approximately normal distributed by the central limit theorem and use the normal distribution for your bounds. As the sum of bernoulli variables is binomial distributed, you could also use the binomial distribution directly.

In other words: there are many ways you can get your answer.

  • $\begingroup$ Is there some way I can easily plugin a population number and get the result? Or some table already having the samples per size? $\endgroup$
    – Jim
    Commented Apr 6, 2023 at 8:50
  • $\begingroup$ I mean the sample size is $n$. The population number has no effect. As you can see in Chebyshev's inequality you could plug in different $n$ there. Although I suggest you use a different inequality. That one is not tight at all. You could also use the cumulative distribution function of the binomial distribution for a precise result. Since that includes factorials, this is likely only numerically stable for small $n$. For large $n$ the normal approximation is probably best. Chernoff bounds would be the a compromise in ease of use and precision $\endgroup$
    – Felix B.
    Commented Apr 6, 2023 at 8:53
  • $\begingroup$ Another comment: Drawing iid from a population implies you can draw the same item twice. If you draw without putting the item back, then the maths is much more complicated. If the number of items you draw is small in comparison to the total population, this problem is likely negligible. But not if it is of similar size $\endgroup$
    – Felix B.
    Commented Apr 6, 2023 at 8:55
  • $\begingroup$ So how exactly would I calculate for e.g. population of $500000$? I don't know what $Ε$ is supposed to be? I thought there would be already some matrix showing the samples per population size. You suggest that we get the probability of each sample size? What does the $0.05$ mean in your answer? $\endgroup$
    – Jim
    Commented Apr 6, 2023 at 9:00
  • $\begingroup$ $\mathbb{E}$ is the expectation. E.g. in your case the 5%=0.05 $\endgroup$
    – Felix B.
    Commented Apr 6, 2023 at 9:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .