My questions are:

  1. Is the following slice-sampling-within-Gibbs approach valid?
  2. Is there a good reference out there that uses, or better yet, justifies it?


I'm trying to sample from a high-dimensional joint distribution, which I'll simplify to $p(x, y)$. Let's say $x$ and $y$ are scalars for now. I would like to use a Gibbs sampler to draw samples. I.e., I would like to iterate:

  1. Sample $x$ from its full conditional, $p(x | y)$.
  2. Sample $y$ from its full conditional, $p(y | x)$.

Unfortunately, I can't sample from $p(x | y)$ or $p(y | x)$ directly. In my case, I have also tried replacing these Gibbs steps with Metropolis-Hastings and rejection sampling, but results were poor. I have had much better results replacing each Gibbs step with a univariate slice sampler. (See Radford Neal's 2003 paper for an explanation of slice sampling.) Now, I do a slice-sampling-within-Gibbs algorithm.


  1. Use univariate slice sampling to draw $x$ from $p(x | y)$.
  2. Use a separate and independent univariate slice sampler to draw $y$ from $p(y | x)$.

In case there is any confusion with multivariate slice sampling, what I specifically mean is:

  1. Sample $u$ from Uniform(0, $p(x|y)$).
  2. Sample $x$ from Uniform$\{x : u < p(x | y)\}$.
  3. Sample $v$ from Uniform(0, $p(y|x)$).
  4. Sample $y$ from Uniform$\{y : v < p(y | x)\}$.

where the uniforms in steps 2 and 4 are not known exactly. (Also, I don't need the samples of $u$ or $v$, so I discard those.)

  • 1
    $\begingroup$ You can put slice sampling steps for sampling conditionals within a Gibbs sampler. e.g. see Slice-within-Gibbs sampling. It's actually quite common. $\endgroup$
    – Glen_b
    Commented Jan 27, 2016 at 3:50
  • $\begingroup$ @Glen_b Great to know, though the Wikipedia article you cited doesn't actually cite a peer-reviewed journal for that. If I'm going to use the method, I'll need a solid journal reference. $\endgroup$
    – cgibin
    Commented Jan 27, 2016 at 4:54
  • 2
    $\begingroup$ If your slice sampler at a given step is generating a value from a correct full conditional, there's really nothing to prove. If you're doing anything more complicated, you could actually just demonstrate that whatever sampling scheme you come up with satisfies the conditions for convergence to the relevant stationary distribution. You might find the discussion in Robert and Casella on the relationship(s) between slice sampling and the Gibbs sampler useful. (You might also note the use of the slice sampler - along with other samplers - in say BUGS or OpenBUGS) $\endgroup$
    – Glen_b
    Commented Jan 27, 2016 at 6:31

2 Answers 2


I found two references. This one details the algorithm, but the publicly-available pages that I could see on Google Books don't prove that it works.

    Author = {Cruz, Marcelo G. and Peters, Gareth W. and Shevchenko, Pavel V.},
    Chapter = {7.6.2: Generic univariate auxiliary variable Gibbs sampler: slice sampler},
    Publisher = {Wiley},
    Title = {Fundamental Aspects of Operational Risk and Insurance Analytics: A Handbook of Operational Risk},
    Year = {2015}}

Another one, also partially available on Google Books for free, seems to allude to slice-sampling-within-Gibbs.

    Author = {Banerjee, Sudipto and Carlin, Bradley P. and Gelfand, Alan E. },
    Chapter = {9.4.1: Regression in the Gaussian case},
    Edition = {2nd},
    Publisher = {CRC Press},
    Title = {Hierarchical Modeling and Analysis for Spatial Data},
    Year = {2015}}

I agree, it would be nice to find solid proof of validity, preferably in a good journal.

EDIT: Even Gelman's famous "Bayesian Data Analysis" (3rd ed) mentions the idea. In Section 12.3: Further extensions to Gibbs and Metropolis, under the "Slice sampling" heading, the end of the first paragraph says

Slice sampling refers to the application of iterative simulation algorithms on this uniform distribution. The details of implementing an effective slice sampling procedure can be complicated, but the method can be applied in great generality and can be especially useful for sampling one-dimensional conditional distributions in a Gibbs sampling structure.

Neal's famous 2003 slice sampling paper is where I think it was first suggested. The first paragraph of Section 4 says

Slice sampling is simplest when only one (real-valued) variable is being updated. This will of course be the case when the distribution of interest is univariate, but more typically, the single-variable slice sampling methods of this section will be used to sample from a multivariate distribution for x = (x1,...,xn) by sampling repeatedly for each variable in turn. To update xi, we must be able to compute a function, fi(xi), that is proportional to p(xi|{xj}j̸=i), where {xj}j̸=i are the values of the other variables.

Yet I still can find no proof of correctness.

  • $\begingroup$ Did you manage to progress on this one? Was asking myself the same question... $\endgroup$
    – Julien
    Commented Dec 14, 2019 at 17:56
  • 1
    $\begingroup$ Not on tracking down a proof or writing one ourselves, but we did use slice sampling within Gibbs in a paper: tandfonline.com/doi/abs/10.1080/…. The model seems to perform well on simulated datasets, coverage of true parameters in credible intervals is close to nominal. $\endgroup$
    – landau
    Commented Dec 14, 2019 at 19:35

It is generally the case that any valid MCMC scheme for univariate distributions can be applied to a univariate conditional distribution as part of an MCMC scheme for sampling from a multivariate distribution. This fact is used extensively all over the literature on MCMC. Its proof is straightforward. There is no need to prove anything special in this regard for slice sampling in particular.


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.