By xi’an

**R – Xi’an’s Og**, and kindly contributed to R-bloggers)

The Riddler of this week has an extinction riddle which summarises as follows:

One observes a population of N individuals, each with a probability of 10⁻⁴ to kill the observer each day. From one day to the next, the population decreases by one individual with probability

K√N 10⁻⁴

What is the value of K that leaves the observer alive with probability ½?

Given the sequence of population sizes N,N¹,N²,…, the probability to remain alive is

where the sum stops with the (sure) extinction of the population. Which is the moment generating function of the sum. At x=1-10⁻⁴. Hence the problem relates to a Galton-Watson extinction problem. However, given the nature of the extinction process I do not see a way to determine the distribution of the sum, except by simulation. Which returns K=26.3 for the specific value of N=9.

N=9 K=3*N M=10^4 vals=rep(0,M) targ=0 ite=1 while (abs(targ-.5)>.01){ for (t in 1:M){ gen=vals[t]=N while (gen>0){ gen=gen-(runif(1)<K*sqrt(gen)/10^4) vals[t]=vals[t]+gen} } targ=mean(exp(vals*log(.9999))) print(c(as.integer(ite),K,targ)) if (targ<.5){ K=K*ite/(1+ite)}else{ K=K/(ite/(1+ite))} ite=ite+1}

Filed under: R, Travel Tagged: Francis Galton, Galton-Watson extinction, R, The Riddler

**leave a comment**for the author, please follow the link and comment on their blog:

**R – Xi’an’s Og**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more…

Source:: R News