Using conjugate priors to estimate the posterior distribution of a proportion of a region composed by subregions Let's say I have a region that is divided into 3 subregions. In each subregion, I run ~90-110 randomly allocated surveys asking a binary question.
I want to know if the way that I am estimating the region's proportion of people that answered "yes" is valid. This is my approach:
Context:

*

*We have a region composed of subregions 1, 2, and 3. We want to estimate the proportion of people that answer "yes" to a question. We randomize at the subregion level.

Data

*

*Subregion 1: 10 yes, 80 no. This subregion represents 500 people.

*Subregion 2: 20 yes, 90 no. This subregion represents 1000 people.

*Subregion 3: 50 yes, 50 no. This subregion represents 4000 people.

Posterior distribution calculation
Let's assume, for simplicity, that we use the Beta(1, 1) prior and a Binomial likelihood. So our posterior for each subregion is the following:

*

*Subregion 1: Beta(11, 81)

*Subregion 2: Beta(20, 90)

*Subregion 3: Beta(50, 50)

Now, to calculate the region posterior distribution (assuming independence of the subregions), I am doing the following:

*

*I take samples for each subregion proportion parameter and calculate the following: (pop_subregion_1prop_samples_subregion_1 + pop_subregion_2prop_samples_subregion_2 + pop_subregion_3*prop_samples_subregion_3)/(total_population)

*The code to replicate this in R, for this example, would be:

prop_samples_subregion_1 <- rbeta(n=10000, shape1 = 11, shape2 = 81) 
prop_samples_subregion_2 <- rbeta(n=10000, shape1 = 20, shape2 = 90)
prop_samples_subregion_3 <- rbeta(n=10000, shape1 = 50, shape2 = 50))

# Edit: Added the division to the total population (5500)
prop_samples_region <- (500*samples_subregion_1 + 1000*samples_subregion_2 + 4000*samples_subregion_3)/5500

Questions

*

*Is this approach correct to calculate the proportion of people that would answer "yes" in the region?

*Is there a more computationally efficient to do it? I need this calculation to run fast, that's why I am using conjugate priors.

*Would this approach work independently of the prior/likelihood I use? For example a Normal-Normal model.

 A: The code below does not tell you how many samples would you observe, but you are calculating the expected values of the number of samples. If you know that the coin is fair, tossing it $100$ times would not produce $100 \times 0.5 = 50$ heads, but some random number of heads with a probability of $0.5$. To draw samples of the "number of samples per subregion" you need to sample from beta-binomial distribution which is the posterior predictive distribution for the beta-binomial model.

samples_region <- 500*samples_subregion_1 + 1000*samples_subregion_2 + 4000*samples_subregion_3


Your code should be rather something like the below:
samples_subregion_1 <- rbinom(n=N, size=500, prob=rbeta(n=N, shape1 = 11, shape2 = 81))
samples_subregion_2 <- rbinom(n=N, size=1000, prob=rbeta(n=N, shape1 = 20, shape2 = 90))
samples_subregion_3 <- rbinom(n=N, size=4000, prob=rbeta(n=N, shape1 = 50, shape2 = 50))

samples_region <- samples_subregion_1 + samples_subregion_2 + samples_subregion_3



*

*Is this approach correct to calculate the proportion of people that would answer "yes" in the region?


It depends. You are assuming that each region is independent of others, does this assumption hold? Only in such a case, you can consider them separately, calculate probabilities independently, sample from them, and sum the samples. If they are not independent, you need a much more complicated model that won't be as simple and as computationally efficient as the simple beta-binomial model.



*Is there a more computationally efficient to do it? I need this calculation to run fast, that's why I am using conjugate priors.


In Bayesian statistics, you cannot go any more computationally efficient than using conjugate priors.



*Would this approach work independently of the prior/likelihood I use? For example a Normal-Normal model.


It would work in each case where you have conjugate priors. I'm not sure what you mean here, because for the described problem you cannot use normal likelihood as it would predict negative counts.
