Recently I have been teaching myself how to Bayesian calculations with the BUGS language (JAGS, in particular). However, I find myself wondering how one might use Mathematica to do similar calculations (perhaps based around NIntegrate). I would be most interested in building up models using the awesome combined computing/graphing facilities that Mathematica provides. I have a copy of "Bayesian Logical Data Analysis for the Physical Sciences" and while it is an excellent and enjoyable book, I think that it more focused on "analytic" solutions than "numerical"--it seems that more complicated models would quickly outpace the ability to obtain analytic solutions.
For example, consider the problem of inferring the difference between two rates, taken from Lee and Wagenmaker's book:
model {
# Prior on Rates
theta1 ~ dbeta(1,1)
theta2 ~ dbeta(1,1)
# Observed Counts
k1 ~ dbin(theta1,n1)
k2 ~ dbin(theta2,n2)
# Difference between Rates
delta <- theta1 - theta2
}
Given k1, n1, k2, and n2, how might I translate this into Mathematica to get, e.g. the posterior density of theta, the difference in rates, I suppose p(delta | k1,k2,n1,n2) ? (For example, k1=5, k2=7, n1=n2=10). Knowing how this is done would go a long way toward me being able to build and solve other models!
