tag:blogger.com,1999:blog-6894866515532737257.post9180013948099250998..comments2024-03-27T01:01:09.785-07:00Comments on Probably Overthinking It: The Rock Hyrax ProblemAllen Downeyhttp://www.blogger.com/profile/01633071333405221858noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-6894866515532737257.post-62036019555430054202015-01-27T07:54:59.796-08:002015-01-27T07:54:59.796-08:00Your solution looks good. But I encourage you to ...Your solution looks good. But I encourage you to resist the temptation to collapse the posterior distribution to a point estimate (like an MLE, MAP, or posterior mean). One of the big advantages of the Bayesian approach is that you get a posterior distribution, which captures everything you know/believe about the value, and not just a point estimate or interval.Allen Downeyhttps://www.blogger.com/profile/01633071333405221858noreply@blogger.comtag:blogger.com,1999:blog-6894866515532737257.post-87584054156710126282015-01-27T07:49:30.600-08:002015-01-27T07:49:30.600-08:00I'm useless at stats, so please let me know if...I'm useless at stats, so please let me know if my answer is correct.<br /><br />The first solution I came up with is:<br />If in a sample of 10 I capture 2, then that means that the population is 5 times larger than the number I've tagged. Since I tagged 10, there would be 50 hyraxes.<br /><br />My second solution is using Python. <br />I assume they'll be at most 100 hyraxes as working assumption, and see how far that takes me. The approriate pmf is the hypergeom distribution. Given a population M, with a sample size N = 10, and number of tagged hyraxes n = 10, what is the probability of observing k = 2 tagged hyraxes?<br />So let me create a simple program and observe the output:<br />from scipy.stats import hypergeom<br />for population in range(11,100):<br /> prob = hypergeom.pmf(k = 2, M = population, n = 10, N = 10)<br /> print(population, prob)<br /><br />The output shows a maximum probability at populations of sizes 49 and 50. They're the maximum likelihoods. So, 50 it is, then.<br /><br />Regards,<br />Mark Carter.Anonymoushttps://www.blogger.com/profile/04470463426170671630noreply@blogger.comtag:blogger.com,1999:blog-6894866515532737257.post-83746985887960347122014-12-05T05:52:31.168-08:002014-12-05T05:52:31.168-08:00Hi João. Thanks (again) for your solution. It lo...Hi João. Thanks (again) for your solution. It looks great!Allen Downeyhttps://www.blogger.com/profile/01633071333405221858noreply@blogger.comtag:blogger.com,1999:blog-6894866515532737257.post-4291993094199262182014-12-05T02:01:13.322-08:002014-12-05T02:01:13.322-08:00ok, I programmed it in BUGS using the Jeffrey'...ok, I programmed it in BUGS using the Jeffrey's prior :-) My solution suggests there are around 40 hyraxes for this data (I tried with a maximum of 500 and 1000 hyraxes, and the results were relatively stable).<br /><br />The code and results are here http://www.di.fc.ul.pt/~jpn/r/bugs/hyraxes.html<br /><br />Cheers,João Netohttps://www.blogger.com/profile/05560718055133816500noreply@blogger.comtag:blogger.com,1999:blog-6894866515532737257.post-70916318109925497812014-12-05T01:02:40.651-08:002014-12-05T01:02:40.651-08:00You should try Jeffrey's prior $p(N) \propto 1...You should try Jeffrey's prior $p(N) \propto 1/N$ that can be normalized for any given M. This will make it more robust to changes of M.<br /><br />Also, you could narrow the interval to [N-n+k,M] instead of [1,M].João Netohttps://www.blogger.com/profile/05560718055133816500noreply@blogger.com