Sampling a specific country from the hierarchical model example

I’m assuming you mean ‘get the posterior distribution for a specific county only, after having performed inference using all counties.’ (The alternative would be to perform inference using just the observed data from a specific county, in which case the hierarchical model wouldn’t make sense).

a and b are 1-D arrays n_counties long. So you just want to get the samples for all counties, and choose only those for the county you are interested in:

a_samples = hierarchical_trace.get_values('a', thin=5)
aitkin_idx = 0  # this is a guess; the point is, each county has a unique integer index
aitkin_a_samples = a_samples[:, aitkin_idx]