Consider a sample $N$ numbers, independently drawn from a discrete uniform distribution over $\{1,2,...,k\}$, with replacement. Suppose I know that at least one of the $N$ numbers is 7 (like the sex of one child is known in the boy or girl paradox). What is the probability distribution of the number of 7s, given that there is at least one?

Here's my progress so far:

The total possible number of samples are $k^N$, all of which are equally likely under the uniform distribution. The total number of combinations of names without any 7s is $(k-1)^N$. Therefore, the total number of combinations with at least one 7 is $k^N-(k-1)^N$.

Only one of the combinations has all 7s, so that probability that all are 7,
$$Pr(\#7=N|\#7 \geq 1)= \frac{1}{k^N-(k-1)^N} $$
I'm quite confident in this answer, but don't know about $Pr(\#7=x|\#7 \geq 1)$ for $x<N$.

Edit 1:
whubner's comment lead me to what (I think) is the answer. The unconditional probability of having $x$ sevens is the same probability as flipping a bias coin with a $1/k$ probability of heads $N$ times and having $x$ heads. This is given by the binomial distribution:
$$P(\# 7=x)=(\frac{1}{k})^x(\frac{k-1}{k})^{N-x} \binom{N}{x} $$
In order to get the conditional distribution we can use Bayes' rule and divide by the probability that there is at least one seven:
$$P(\# 7=x|\# 7 \geq 1)=\frac{P(\# 7=x)}{P(\# 7\geq 1)} =\frac{P(\# 7=x)}{1-P(\# 7= 0)} $$
Written out, this is,
$$P(\# 7=x|\# 7 \geq 1)=\frac{(\frac{1}{k})^x(\frac{k-1}{k})^{N-x} \binom{N}{x}}{1-(\frac{k-1}{k})^{N}} $$
(Whenever $x\in\{1,2,...,N\}$ and zero otherwise)

$\begingroup$Can you work out the distribution of the number of sevens unconditionally? Hint: consider the random variable $X$ which is equal to $1$ when a seven is drawn and otherwise equals $0.$$\endgroup$
– whuber♦Apr 21 '18 at 13:48

1 Answer
1

Let $X_1,...,X_N \sim \text{IID U} \{ 1,...,k \}$ be your sample data and let $W = \sum_{i=1}^N \mathbb{I}(X_i=7)$ be the number of sevens in the sample. Since you are sampling with replacement via uniform sampling, the random variable $W$ follows a binomial distribution with probabilities given by the proportion of sevens in the categories: