# Probability of getting three zeros when sampling a set

Say we have a set of $12$ numbers - $(0,1,2,0,3,0,4,0,5,6,0).$ We go thru this set one number at a time, and choose a number with a probability $1/3$; we sample. What is the probability we end up with $3$ $0$'s out of the $4$ numbers we will likely choose(on average)? Is there a closed-form solution for this?

-
That's sampling without replacement. You should read up on the hypergeometric distribution – kahen Nov 14 '10 at 19:48
@kahen: no it isn't, since they go through the list one number at a time. – Yuval Filmus Nov 14 '10 at 19:55
@probability_noob: Your list is of length 11. – Yuval Filmus Nov 14 '10 at 19:56
Also, it's not clear what is the event whose probability you're trying to calculate (Nate and me offer conflicting interpretations). – Yuval Filmus Nov 14 '10 at 19:58
Sorry about the confusion, and thanks for answering. To rephrase: – probability_noob Nov 14 '10 at 20:04

If I understand the problem, you have a list of 12 objects, 5 of which are special (the 0s). (I use the word "list" instead of "set" since the latter implies there is no repetition among the objects). Each of the 12 objects will be independently considered, and "chosen" with probability 1/3. You want to know the probability of 3 of the special objects being chosen.

In that case, the 7 non-special objects are irrelevant. You just want to know the probability that exactly 3 out of 5 independent events occur, when each one occurs with probability 1/3. This is the probability of a binomial random variable with $n=5$ and $p=1/3$ taking on the value $3$. The linked Wikipedia page has a formula for computing this.

-
Thanks for the answer. Yes, a set is a bit misleading here. Consider a stream of values with different frequencies(in the example above, 0 has more frequency) and you are sampling with a probability p. I want to know what is the probability that I sample high frequency events and the probability that I sample low frequency events (say the number 1 or 2 or 3 etc). – probability_noob Nov 14 '10 at 20:03

In your original question it sounded like you wanted the conditional probability $P\{\text{we obtain 3 0's}|\text{4 events are sampled}\}$ which is the number of size 4 subsets that contain 3 0's divided by the total number of size 4 subsets which would be, if $k$ is the number of 0's total, $$\frac{{k \choose 3}{12-k \choose 1}}{{12 \choose 4}}$$

In general it sounds like what you really want is the probability that any single sample is either a high frequency event or a low frequency event. Say you have an event that occurs with a high frequency, but that each trial is independent, we can model this by giving it a probability, say $p_h=\frac{n}{100}$ where n is the average # that occur in any 100 trials.

Now say you sample each trial independently with probability $p_s$. Then the probability that any single sample is one of the high frequency events is the conditional probability $$P\{\text{event is the high frequency event}| \text{event is sampled}\} = p_h$$ This is because, presumably, your sampling and your event occurrences are independent

It also sounds like you would like the expected value of the number of high frequency events sampled given a certain number of total events, $n$. Consider any single event. In order for it to be a "success" it has to be both a high frequency event and be sampled. $$P\{\text{an event is high frequency and is sampled}\} = p_h p_s$$ The probability to have $k$ high frequency events sampled when you have $n$ total events is a binomial distribution with parameter $p_hp_s$. $$P\{k \text{ of our sampled events are high frequency events}\} = {n \choose k} (p_sp_h)^k(1-p_sp_h)^{n-k}$$ The expected number of sampled events that are high frequency is then just $np_sp_h$

Everything works the same with a low frequency event, just use an appropriate $p_l$ instead of $p_h$.

-

If I understand the problem, you have a sequence of independent and identically distributed random variables $X_1,X_2,\ldots,X_n$ (in your example $n=11$, as noted by Yuval), such that ${\rm P}(X_i = j) = p_j$ (in your example $j \in \lbrace 0,1,\ldots,6 \rbrace$); you sample each $X_i$ with probability $p$ (so in average you pick $pn$ numbers; in your example $p=1/3$), and wants to find the probability $P(n,j,m)$ of obtaining $0 \leq m \leq n$ occurrences of the number $j$. Then, this probability can be computed, using the law of total probability, as follows: $$P(n,j,m) = \sum\limits_{k = m}^n {{n \choose k}p^k (1 - p)^{n - k} {k \choose m} p_j^m (1 - p_j )^{k - m} }.$$ The term ${n \choose k}p^k (1 - p)^{n - k}$ corresponds to sampling $k$ $X_i$'s out of $n$, and the term ${k \choose m} p_j^m (1 - p_j )^{k - m}$ corresponds to obtaining $m$ occurrences of the number $j$ given that $k (\geq m)$ $X_i$'s were sampled. The rest is left for you.

-

The probability that you want is $(1/3)^4(2/3)^8 N$, where $N$ is the number of subsets of length $4$ containing exactly $3$ zeroes.

-
This would be correct if we chose four out of twelve, but we do not. – Raphael Nov 14 '10 at 20:20
@Raphael: Rather, it's the probability <i>to</i> choose four out of twelve in such a way that there are three zeroes. – Yuval Filmus Nov 14 '10 at 20:57