## 31.2 Bayesian poststratification

Considering the same polling data from the previous section in a Bayesian setting, the uncertainty in the estimation of subgroup support is pushed through predictive inference in order to get some idea of the uncertainty of estimated support. Continuing the example of the previous section, the likelihood remains the same, $y_n \sim \textrm{bernoulli}(\theta_{jj[n]}),$ where $$jj[n] \in 1:J$$ is the group to which item $$n$$ belongs and $$\theta_j$$ is the proportion of support in group $$j$$.

This can be reformulated from a Bernoulli model to a binomial model in the usual way. Letting $$A_j$$ be the number of respondents in group $$j$$ and $$a_j$$ be the number of positive responses in group $$j$$, the likelihood may be reduced to the form $a_j \sim \textrm{binomial}(A_j, \theta_j).$ A simple uniform prior on the proportion of support in each group completes the model, $\theta_j \sim \textrm{beta}(1, 1).$ A more informative prior could be used if there is prior information available about support among the student body.

Using sampling, draws $$\theta^{(m)} \sim p(\theta \mid y)$$ from the posterior may be combined with the population sizes $$N$$ to estimate $$\phi$$, the proportion of support in the population, $\phi^{(m)} = \frac\sum_{j = 1}^J \theta_j^{(m)} \cdot N_j} \sum_{j = 1}^J N_j}.$ The posterior draws for $$\phi^{(m)}$$ characterize expected support for the issue in the entire population. These draws may be used to estimate expected support (the average of the $$\phi^{(m)}$$), posterior intervals (quantiles of the $$\phi^{(m)}$$), or to plot a histogram.