Archive for dandelion
épervière [jatp]
Posted in Mountains, pictures, Running, Travel with tags épervière, dandelion, flowers, grouse, hiking, jatp, Lac Saint-Jean, orange, Québec on July 23, 2022 by xi'ansampling w/o replacement except when replacing
Posted in Books, Kids, R with tags dandelion, FiveThirtyEight, hypergeometric distribution, myrtle, R, recursion, sampling without replacement, The Riddler on November 3, 2020 by xi'anAnother Riddle(r), considering a box with M myrtle balls and D dandelion balls. Drawing balls without replacement while they stay of the same color as the initial draw, else put back the last ball and repeat the process until all balls are drawn. The funny thing is that, unless M=0 or D=0, the probability to draw a myrtle ball at the end is always ½..! This can be easily checked by simulation (when M=2 and D=8)
r=function()sample(0:1,1,p=c(d,m)) for(t in 1:1e6){ m=2;d=8 i=r();m=m-!!i;d=d-!i while(!!m*d){ j=r();i=ifelse(i==j,j,r()) m=m-!!i;d=d-!i} F=F+(m>0)} F/1e6
Now the proof that the probability is ½ is quite straightforward, for M=1 (or D=1). But I cannot find a quick fix for larger values. I thus reasoned by recursion, with the probability of emptying a given colour first is d!m!/(d+m)!, whatever the colour and whatever d>0,m>0. Hence half a chance to finish with myrtle. Any shorter sequence of a given colour reduces the value of either d or m, at which point we are using the recursion assumption that the probability is ½…