Suppose that there are a blue balls and b red balls in a box and we would like to sample k balls from them. We can sample the balls with replacement such that after picking each ball we put it back into the box, or we can do it without replacement.
For convenience of discussion, denote n=a+b, p=na and q=nb. Define Xi (i∈[k]) the indicator random variable of whether the i-th selected ball is blue. Let
X=∑Xi
Then we claim that
E[X]=i∈[k]∑E[Xi]=kp
The first equality holds by linearity of expectation. The second equality states that in expectation, p fraction of the selected balls are blue.
The claim is trivial when we sample with replacement, as Pr[Xi=1]=p. To prove that the probability applies for the case of sampling without replacement requires a little more effort, as shown by the following
There are in total (nk) possible combinations of choosing k balls out of n.
Among them there are (a1)⋅(n−1k−1) combinations such that the i-th ball is blue.
Therefore, Pr[Xi=1]=(nk)(a1)⋅(n−1k−1)=na=p.
However, the two sampling scheme have different variance.
We have shown that sampling without replacement has smaller variance than sampling with replacement. Moreover, if n≻k, then n−1n−k≈1 and the two sampling scheme have almost the same variance. We can bound the concentration behavior of X by Chebyshev's inequality: for any c>0,
Pr[∣X−E[X]∣≥c⋅σ]≤c2σ2Var[X]=c21
The 3-sigma rule says only X deviates more than 3σ from its expectation with probability at most 11.11%
Pr[∣X−E[X]∣≥3⋅σ]≤c2σ2Var[X]=91≈0.1111
It is also interesting to observe that the variance most related to the sample size k and probabilities p and q , but not n!