Hacker News new | ask | show | jobs
by idoubtit 2385 days ago
> the sample space changed! Now the possibilities are not just all possible arrangements of 7 children, but all possible arrangements of up to 7 children [...]

> the "stop condition" now is not when there are 7 children total

Your answer makes no sense to me. If you consider the space of possibles combinations that can lead to having a boy and a girl, why do you stop at seven children. Why consider five boys and one girl but reject seven boys and one girl? Both of them are end cases that could be reached.

1 comments

Yes, I was posting in a rush and was being sloppy. Here's a more detailed calculation.

The process involved is that the couple continues to have children until they have at least one of each gender. If we assume that at each birth there is a probability p of having a boy (as I noted in my response to btilly elsewhere, the Bayesian prior would actually be a distribution for p, not a point value, but I'll ignore that here for simplicity), then the process can be modeled as a branching tree something like this:

Child #1: boy -> p; girl -> 1 - p

Child #2: boy - boy -> p^2; boy - girl -> p(1 - p) : STOP; girl - boy -> (1 - p)p : STOP; girl - girl -> (1 - p)^2

So we have a probability of 2p(1 - p) of stopping at child 2.

Child #3: boy - boy - boy -> p^3; boy - boy - girl -> p^2(1 - p) : STOP; girl - girl - boy -> p(1 - p)^2 : STOP; girl - girl - girl -> (1 - p)^3

So we have a probability of [1 - 2p(1 - p)] [p^2(1 - p) + p(1 - p)^2] of stopping at child 3 (the first factor comes from the probability that we didn't stop at child 2 above).

By a similar process we can carry out the tree for as many children as we want. For the case p = 1/2, which was the case I was considering, all of these expressions for the probability of stopping at child #N (for N > 1) simplify to 1 / 2^(N - 1). So the probability of stopping at or before child #N is the sum of those probabilities from 2 to N; for N = 7 that is 1/2 + 1/4 + 1/8 + 1/16 + 1/32 + 1/64 = 63/64. That is close enough to 1 that I ignored cases with more than 7 children; but for a more exact calculation you could add an extra 1/64 to the denominator used to calculate the likelihood (or p-value) of the specific case that was actually observed, to allow for the cases with more than 7 children.

In Bayes' formula, the absolute probability of the observed outcome does not matter. What matters is the ratio of the observed outcome for a given p to the probability under your prior.

The structure of what might have happened does not affect those ratios. Only what was observed does.

> The structure of what might have happened does not affect those ratios. Only what was observed does.

This is true in the sense that you only compute conditional probabilities for the data that was actually observed, not data that could have been observed but wasn't.

However, there's more to it than that; I'll post upthread in a moment with more detail.