Bayes in Riddler mode
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
A very classical (textbook) question on the Riddler on inferring the contents of an urn from an Hypergeometric experiment:
You have an urn with an equal number N of red balls and white balls, but you have no information about what N might be. You draw n=19 balls at random, without replacement, and you get 8 red balls and 11 white balls. What is your best guess for the original number of balls (red and white) in the urn?
With therefore a likelihood given by
leading to a simple posterior derivation when choosing a 1/RW improper prior. That can be computed for a range of integer values of R and W:
L=function(R,W)lfactorial(R)+lfactorial(W)+ lfactorial(R+W-19)-lfactorial(R-8)- lfactorial(W-11)-lfactorial(R+W)
and produces a posterior mean of 59.27 for R and of 120.51 for W. And to the above surface for the log-likelihood. Which is unsurprisingly maximal at (8,11).
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.