Imagine a "risk only" slot machine that takes 'coins' corresponding to some real number fraction of a dollar $p$, returns the coin with probability $p$, and eats the coin with probability $(1-p)$. For example, a dime would be eaten with a probability of 90%, a nickel with probability 95%, and so forth.

So let's keep feeding the machine two kinds of coins, $A$ and $B$, with fractional dollar values of $p_A$ and $p_B$, respectively. I have $n_A$ coins of type $A$ and $n_B$ coins of type $B$. Each time I use the slot machine, I randomly select a coin, ignoring its type, and place it in the machine. I stop feeding coins into the machine when I run out of either type.

CLARIFICATION - By "randomly select a coin" I mean that we select a coin from the population of all coins uniformly and randomly. For instance, if we have $100$ dimes and $567$ nickels, we'd draw a dime with probability $\frac{100}{667}$.

At this stopping point, what is the probability of ending with only coins of type A or only coins of type B? Provided we end with coins of one type / denomination, what probability distribution and expectation do we have for the number of remaining coins of this type / denomination?

I'd also be curious on the number of coins of either type we needed to feed to the machine to reach this end-state? E.g. how many times did we feed the machine a dime, and how many times did we feed the machine a nickel before stopping?

(Important Note) - I asked this question over at math.stackexchange about a week ago (https://math.stackexchange.com/questions/579894/ruin-time-for-a-two-input-risk-only-slot-machine) and never recieved any answers. I hesitate to post it here, because it seems too low level, so please provide me feedback if I've erred, and I'll delete the question.

This kind of Polya's urn problem naturally arises in any situation where we sequentially and uniformly select elements from a population, run a test to decide whether to keep an element or discard it, and where the test has some probability of failing that is specific to the element being tested. For example, maybe we're sequentially and uniformly selecting cells from a population, testing to see if they're cancerous at the single cell level, and then killing or replacing the cells depending on the outcome of the test.

A very specific example of this scenerio can occur in the context of Fluorescence Activated Cell Sorting (FACS) (http://www.bio.davidson.edu/courses/genomics/method/facs.html), where cells are irradiated and imaged one-by-one, and an on-the-fly decision must be made for how the cell should be sorted (depending on some criterion related to fluorescent markers). To be careful though, sorting cells into two bins and then running one of the bins through the sorting procedure again is a distinct process from the one we describe and care about in the above problem description! To stay true to the above problem description, we'd need to have a single rejection bin and immediately return cells that are not discarded to the general population s.t. they have the same chance of being selected during the next test cycle as any other cell.

On Douglas Zare's suggestion, and if it helps, I can provide some simulation data (based on Mathematica's PRNG). For example, starting with $100$ dimes and $100$ nickels:

$n_A = 100$

$n_B = 100$

$p_A = 0.10$

$p_B = 0.05$

We achieve the following results for $10^4$ trials:

The mean number of times we place a dime in the machine $= 109.721$ (Median $ = 110$)

The mean number of times we place a nickel in the machine $= 104.42$ (Median $ = 104$)

The number of times we end with only dimes: $5669$

The number of times we end with only nickels: $4331$

The average number of dimes at the end state (conditioned on running out of nickels first): $2.18328$ (Median $= 2$)

The average number of nickels at the end state (conditioned on running out of dimes first): $1.80513$ (Median $= 1$)

**

Let's do another simulation starting with $82$ copies of hypothetical 75 cent coins and $432$ copies of 5 cent nickels, and again perform $10^4$ trials:

$n_A = 82$

$n_B = 432$

$p_A = 0.75$

$p_B = 0.05$

We achieve the following results for $10^4$ trials:

The mean number of times we place a 75 cent coin in the machine $= 268.213$ (Median $ = 267$)

The mean number of times we place a 5 cent nickel in the machine $= 454.734$ (Median $ = 455$)

The number of times we end with only 75 cent pieces: $9999$

The number of times we end with only 5 cent nickels: $1$

The average number of 75 cent coins at the end state (conditioned on running out of 5 cent nickels first): $14.9384$ (Median $= 15$)

The average number of nickels at the end state (conditioned on running out of dimes first): $1$ (Median $= 1$)

5more comments