Martyn or anyone else - your help greatly appreciated...

I am trying to understand how the dsum sampler works on a fundamental basis.

If you have C = A + B, then Bayes theorem gives that P(C|Data) ~ P(Data|C).P(C)

If you happen to know the functional form then you can calculate some of this via convolutions. Eg if A and B are both normal then C is also normal. P(C) can then be calculated and you can sample C.

But then you have to apportion C into A and B in a way which is consistent with P(A) and P(B). From Bayes theorem, P(A,B|C) ~ P(C|A,B).P(A).P(B) (I have assumed here for simplicity that A and B are independent). Sampling A and B simultaneously requires you to sample from the joint distribution which is not simple even for the normal-normal case.

Alternatively, you can do Gibbs sampling, given a value of A given B and C, and then get a value of B given A and C, etc, but this is inefficient and my understanding is that this is precisely what dsum is trying to avoid (otherwise you'd just specify your model in JAGS code as normal and not worry about any of this).

Is there some simple trick for getting from a sample of C to samples of A and B that are consistent with P(A) and P(B)?

JAGS seems to be able to deal with real variables without knowledge of the actual functional form. How does it do this?

Many thanks