Hypothesis testing via separate inference for each group and then combining Suppose there are two groups, A and B, and we are interested in inferring a certain parameter for each one and also the difference between the two parameters. Here we can take a Bayesian perspective and strive for a posterior distribution in each case. I am wondering if the following is a sound way of doing this:

*

*estimate the posterior for group A,

*estimate the posterior for group B, and

*estimate the posterior of the difference by sampling extensively the first two posteriors and taking the difference.

I am specifically unsure about this kind of divide-and-conquer approach where each group is treated separately, and then the results are combined. Usually, it is done in one take where, perhaps, a linear model is fitted with an indicator for the group membership.
Let me give a simple example. Say, the outcome is binary. One can then use a Bernoulli–beta model to infer the posterior of the success probability, which will be a beta distribution for each group. As the last step, one can sample the two betas and get a posterior for the difference.

I don't have the reputation points to respond as a comment to another answer, but intuitively, what you are doing is fine if you assume there is no relationship between group A and group B.
How could such an assumption show up in your model?  It would almost certainly be in the prior distribution.  For a proportion, let's say you have 500 successes in 1000 trials in Group A, and 100 successes in 1000 trials in Group B.
If you assume independent Beta(1,1) priors (that's what the other posters means when they say "factorizing"), then the posteriors are Beta(501, 1001) for Group A and Beta(101, 10001) for Group B.
But you could also imagine a scenario in which you have little prior information, expect little data, and expect your two groups to be somewhat similar.  Maybe it would make sense to utilize the information in the other group to inform the posterior.  For instance, since we observed 50% success in Group A, and 10% success in Group B, we could say "I expected Group A to be around 40% and Group B to be around 20%", where we move our estimates towards the average of the two groups, 600 successes in 2000 trials = 30%.  If your prior distributions are like this, then your estimates for theta_A and theta_B will correlated, and you can't independently sample like you want, because you won't be properly accounting for that correlation.
I assume you didn't do this for your priors, so I don't think you will have anything to worry about.
