14

A probability $p$ is chosen uniformly randomly from $[0,1]$, and then a subset of a set of $n$ elements is formed by including each element independently with probability $p$. In answering Probability of an event if r out of n events were true. I realized that the probability

$$ \int_0^1\binom nrp^r(1-p)^{n-r}\mathrm dp=\frac1{n+1} $$

of obtaining a subset of size $r$ is independent of $r$; so all $n+1$ subset sizes are equiprobable. This is a neat fact that I wasn’t aware of before. There must be a nicer, more insightful way to show this than to evaluate this integral (which can be done using integration by parts).

joriki
  • 238,052
  • Is $p$ the same for each element? Or does each element get its own $p$? – paw88789 Jan 19 '20 at 14:06
  • 2
    @paw88789: The same; I've clarified the question accordingly. – joriki Jan 19 '20 at 14:15
  • I may be misunderstanding what you are asserting. I am interpreting that what you are saying is equivalent to: If you take a biased coin and flip it $n$ times, getting $0$ heads or $1$ heads or ... or $n$ heads are all equally likely. That can't possibly be right. – paw88789 Jan 19 '20 at 14:20
  • @paw88789: No, I'm saying that these $n+1$ counts of heads are all equally likely if you have a (continuous) selection of coins with biases uniformly distributed over $[0,1]$ and you pick one of them and flip it $n$ times. You're of course right that for any particular biased coin, the counts will have different probabilities (namely the ones in the integrand, which depends on $r$, in contrast to the integral). – joriki Jan 19 '20 at 14:23
  • Thanks for the clarification! – paw88789 Jan 19 '20 at 14:25
  • 1
    Great insight! I'm not sure one could be stated in terms of the other but this reminds me a lot of Polya's urn. – Shai Deshe Jan 19 '20 at 15:14
  • I think you should be clearer about the process here, because it's a rather unusual set-up. Perhaps: "A number $p$ is chosen uniformly from $[0,1]$, and then a subset of a set of $n$ elements is formed" etc. – TonyK Jan 19 '20 at 20:08
  • @TonyK: OK, done. – joriki Jan 19 '20 at 20:55
  • @ShaiDeshe: I think your association with the Pólya urn model is very relevant. The Pólya urn behaves exactly as the present coin. From this perspective, answering the present question boils down to giving an elegant derivation of the rule of succession, which the Wikipedia article unfortunately also derives by integration. – joriki Jan 19 '20 at 21:48
  • @ShaiDeshe: The connection to the Pólya urn is drawn here (alluded to in the question and spelled out in the answer). But again the rule of succession is derived by integration despite its simple form. – joriki Jan 19 '20 at 22:03
  • More than 6 years I posed this question, and answered it myself. I ended the answer with the conjecture that things could/should be more simple. Now - inspired by this and the answers on it - I finally found out. This is published in my second answer which can be looked at as a discrete version of what is brought up here. – drhab Jan 21 '20 at 10:06

2 Answers2

10

The answer is as simple and elegant as I thought it must be, and is given in this answer (which states that Bayes used this argument).

To decide whether to include an element in the subset, we can generate a number $r$ uniformly randomly in $[0,1]$; we include the element if $r\lt p$.

Now consider the probability $p$, which is also uniformly randomly drawn from $[0,1]$, as an $(n+1)$-th number of the same kind. The size of the subset is the number of times that $r\lt p$. By symmetry $p$ is equally likely to have any of the $n+1$ ranks among these $n+1$ numbers.

joriki
  • 238,052
  • Am I the only one who thinks a gambler could use this fact? If use a fair coin to answer two multiple choice questions each with two options, we have a 25% chance of getting both questions right. But if we use a randomly selected coin whose probability of showing heads is uniformly distributed in $[0,1]$, then we have 33% chance of getting both questions right. Am I missing something? – Marco Jan 20 '20 at 02:14
  • @Marco: I don't see what you're concluding that from. If you do that, you have a $\frac13$ chance each of choosing the first option $0$, $1$ or $2$ times. That doesn't change the fact that you have an independent $\frac12$ chance of getting each question right and thus a $\frac14$ chance of getting them both right. For your chance to be higher, it would have to be the test authors, not you, who use the randomly selected biased coin. If they use such a coin to decide whether to put the correct answer first or second, and you always choose first, then your chance increases to $\frac13$. – joriki Jan 20 '20 at 05:10
  • I still don't get it. Instead of thinking of the options as first and second, why can't we think of them as right and wrong. Then according to your logic, we have a 1/3 chance each of choosing the right answers 0, 1, or 2 times. – Marco Jan 20 '20 at 05:55
  • @Marco: No. You don't know which ones are the right answers. That depends on the randomization of the test authors, not just on yours. You don't have the option of saying "I'll let a randomly selected biased coin decide how many right answers I choose". If you did, you could just directly select all the right answers, without any randomness. Whereas e.g. you can indeed select all the first answers if you want. If that's still not clear, try spelling out your thoughts in more detail and consider what exactly you'd do and how exactly you'd use the coin to decide which answer to select. – joriki Jan 20 '20 at 06:20
  • I really like the linked answer (and kind of regret that I could not find it myself)! Further the explanation given in this answer is fine. – drhab Jan 20 '20 at 09:03
  • 1
3

The following is in terms of generating functions. It does not use binomials or beta integrals.

A coin has probability $p$ for heads, and is thrown $n$ times. If you obtain $r$ heads you gain $x^r$. The expected gain then is $$E(p)=\bigl(px+(1-p)\bigr)^n\ .$$ As $p$ is uniformly distributed over $[0,1]$ we now have to calculate $$E:=\int_0^1 E(p)\>dp={1\over n+1}{\bigl(px+(1-p)\bigr)^{n+1}\over x-1}\Biggr|_{p=0}^{p=1}={1\over n+1}{x^{n+1}-1\over x-1}\ ,$$ hence $$E={1\over n+1}(1+x+x^2+\ldots+x^n)\ .$$ This shows that each $r\in[0\>..\>n]$ has the same "overall" probability to occur.