How do I sample a multivariate posterior when I can sample the likelihood and prior?

Suppose I want to sample the posterior distribution of a multivariate $$\beta$$ given some scalar $$x$$. By Bayes' theorem, this distribution is

$$P(\beta|x) \propto P(x|\beta)P(\beta)$$

I don't have the exact form of $$P(x|\beta)$$ but I can generate samples from it. I have the exact form of the prior $$P(\beta)$$ and can sample from it. How do I turn that into a sample from the posterior? Can I just multiply them together?

One crude but easy to implement algorithm is just to use rejection sampling. Given your data $$x$$, we can define some summary statistic $$T(x)$$ of our data - it is more efficient for $$T(x)$$ to be sufficient, but this is not necessary. One choice of $$T(x)$$ could just be the mean of the data. Then, the algorithm is:
1. Sample parameters $$\beta \sim p(\beta)$$
2. Sample fake data conditioned on the parameters: $$x^* \sim p(x^* \vert \beta)$$
3. Compare the summary statistic of our fake data with our real data - if they are "close enough", say within $$\epsilon$$ distance of each other, accept $$\beta$$ as a sample from our approximate posterior.
• You can use[abc] to search for entries on ABC in Cross Validated. Jan 29 '20 at 14:19