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.

The approach you describe makes a lot of sense, if you have independent priors (and likelihoods - you also get problems if observations in the two groups influence each other or are somehow correlated). A simple test for whether you really think that is to consider whether what you think about each group has nothing to do with what you see for the other group. E.g. if I show you one of the groups first, this will not change in the slightest what you expect for the other group.
To take an example, let's assume our outcome in a randomized controlled trial is a count outcome, we assume it's a Poisson distribution and we followed 100 patients on placebo for 1 year and we saw 4000 events. A-priori, we were pretty unsure about the placebo event rate and had a marginal Gamma(0.1,0.1) prior for both treatment groups. A-posteriori we now have a Gamma(4000.1, 100.1) prior for the annualized event rate. Does this change what you expect for the active treatment group? If you have independent priors for the two treatment groups, it does not.
This approach has problems, if you are e.g. somewhat unsure about where each treatment group ends up (you could still have marginal Gamma(0.1,0.1) priors for both treatment groups), but you assume that relative rate reductions (or increases) compared with placebo beyond 90% are pretty unlikely. In that case it might be more plausible to assume a prior such as, say, a N(0, 1) on the log-rate-ratio for treatment vs. placebo (instead of assuming a prior on the treatment group rate, although this of course implies one). In that case, your belief about what you expect to see in the treatment group changes after seeing the placebo group data (it's now the posterior for the placebo log-rate  with the added noise of the N(0,1) prior for the treatment effect).
If that latter option is what you believe a-priori, then the approach you describe is not so suitable. I would guess that this is how many people in the clinical trials space think (i.e. they'd prefer to assign a prior on the expected placebo outcome and a prior on the treatment effect relative to that).
