I'm new to Bayesian inference, and have been following the book Bayesian Methods for Hackers. In this chapter, the author provides an example of how using small sample sizes can lead to extreme results, but doesn't say how to correct for this when modelling the problem.
This is how I'm currently modeling the problem with pymc. average_across_county
is an array of the average person's height per county. There is also an array called population
(unused here) which contains the population of each county.
mu = pm.Uniform('height', 100, 200)
tau = pm.Uniform('precision', 0, 50)
hgt_dist = pm.Normal('hgt_dist', mu, tau, value=average_across_county, observed=True)
mcmc = pm.MCMC([mu, tau, hgt_dist])
mcmc.sample(50000, 2000)
mcmc.trace('height')[:].mean()
The error in above estimate of the true average height is about 10 times larger than a simple weighted average because I don't make use of the population
data. How should I include the population
variable in this model?