# I am drawing balls of three colours from an urn until it is empty. Is the sequence of colours random?

I have the following problem. I have an urn with n balls of k different colours. I draw balls without replacement until the urn is empty. This leads to a sequence of colours. I now want to show that this sequence is random, or at least that no colour is enriched at particular regions of the sequence (e.g. blue balls appear predominantly at the beginning of the sequence). How could I best show that (I know that I am trying to confirm a null hypothesis here, which is not possible, but I need sth. to convince critics that what I am doing is random)? If it helps, you may consider the special case that each colour has the same number of balls. While there are tests for auto-correlation of residuals, I could not find tests for nominal variables. Thanks, Paul

• This seems circular to me. If your selection pays no attention to ball colour, then there won't be biases. The nub is in how you select. An analogous case is selecting random integers from 1 to 10 from a uniform distribution. In that process there is no bias to odd or even integers. So odds or evens won't be selected preferentially. But, more fundamentally, is this a question about probability theory or about analysing data you have or might have? If the latter then simulation is the easiest way to get an idea of the variability expected. – Nick Cox Mar 21 '20 at 12:55
• @Nick If the critics question the correctness of the ball-drawing procedure, then one recourse is to subject its output to tests of randomness. I believe that's what this question is asking. – whuber Mar 21 '20 at 13:12
• Thanks for your comments. To clarify, the critics may question the correctness of the ball-drawing procedure. I want to convince them (and myself) that it is random. So my question is about data I have (a sequence of A, B and C of length 300). By eye, I do not see any patterns of letters being enriched somewhere in the sequence. But it would be nice to put a number on this. – Paul Mar 21 '20 at 17:39
• Plot observed fractions A B C as sequences. Then simulate three sequences randomly say 24 or 48 or 99 times. Plot those with one real series in a 5 x 5 or 7 x 7 or 10 x 10 display. Then an informal line-up test is whether the real data stand out as different. – Nick Cox Mar 22 '20 at 10:49
• Thanks, Nick. This actually worked quite well to see that my observed sequences are not perfectly random. In hindsight, it makes sense, given the generation procedure. In case anyone else reads this, you may also want to try (1) upload your file to randomness-tests.fi.muni.cz and (2) test its randomness via their test suite. – Paul Mar 23 '20 at 17:06