I'm trying to create some kind of iterative Bayesian algorithm, which continuously updates as more data is gathered. However, the distribution of my data is such that there does not exist a conjugate prior, so I'm thinking of using something like Gibbs sampling to generate my posterior distribution.

However, if I want to do another iteration of this Bayesian algorithm with new data, is it possible without a conjugate prior? Because I only have the samples of the posterior distribution, not the actual distribution.


  • 1
    $\begingroup$ To do Gibbs sampling you must be able to evaluate the conditional posterior distribution of each variable conditioned on the other variables. Are you able to do that? If so, then yes can perform another iteration after adding new data, although Gibbs sampling is not an ideal online inference scheme. You might add some information about your model, so we can offer more helpful suggestions. $\endgroup$
    – jerad
    Commented Dec 7, 2012 at 19:33
  • $\begingroup$ I'm running a Bayesian Logistic Regression - so do you mean that you can classify incoming data points and then incorporate them into your existing data set and then rerun the Gibbs sampler? I thought about that, but realized it wasn't very scalable. $\endgroup$
    – Michael
    Commented Dec 7, 2012 at 20:08
  • 1
    $\begingroup$ You might benefit by searching "sequential bayesian" or "sequential monte carlo for bayesian". One of the papers that might be helpful is ftp.idsa.prd.fr/local/aspi/legland/ref/doucet00b.pdf $\endgroup$
    – Tomas
    Commented Dec 7, 2012 at 20:23
  • $\begingroup$ Yes, you sample the new data conditional on the current class assignments. But since your previous data points are dependent on the new data, it's best to perform a Gibbs update on a randomly chosen subset of the new full data set. You can adjust the size of the subset to achieve an appropriate trade-off b/t speed and accuracy. See here for specific details. $\endgroup$
    – jerad
    Commented Dec 7, 2012 at 20:28
  • $\begingroup$ Sequential Monte Carlo or particle MCMC are indeed good keywords to enter the topic! $\endgroup$
    – Xi'an
    Commented Dec 8, 2012 at 17:50

1 Answer 1


One approach is to fit a density estimator to your first posterior distribution, then use the estimated density as the prior in your update. One option for a density estimator to use is logspline densities, see the logspline package in R for one way to fit these.

It depends on what tool you are using to do your gibbs sampling as to how you would specify the logspline (or other estimator) as you prior (once you have the coefficients from the logspline function the log density is just a sum of cubic polynomials so it should be fairly simple to translate to most Gibbs samplers). I have seen a trick in WinBugs and OpenBugs where you use a chisquare as an intermediate distribution but specify your own function that gives your prior. Tools like Stan let you program your own prior. If you do this in regular R then you can just use the logspline functions there.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.