Statistics How To

Slice Sampling: Simple Definition & Steps

Markov Chain Monte Carlo >

Slice sampling (Neal, 2003) is a Markov Chain Monte Carlo (MCMC) method for sampling from a probability distribution. The basic idea is that any distribution can be sampled from by selecting uniformly spaced points under a probability distribution curve using a MCMC algorithm; multivariate distributions can be sampled by treating each variable separately.

Advantages and Disadvantages

Although Neal stated that slice sampling is “easily implemented for univariate distributions,” other authors (e.g. Royle, 2013) have noted that it can be a complicated procedure to implement. It’s probably more accurate to say that it’s easier to implement than other, similar MCMC methods like Gibbs sampling. Plus, it needs less tuning than the Metropolis–Hastings algorithm (Huzurbazar, 2004), which is more sensitive to parameters from proposed distributions. As slice sampling adaptively chooses the magnitude of changes made in prior steps, it is more efficient than basic Metropolis algorithms.

Basic Steps

The basic method is as follows (Bandyopadhyay & Bhattacharya, 2014):

  1. Generate a uniformly distributed random number x.
  2. Select a random curve f(x).
  3. Choose a starting point x0, where f(x0) > 0.
  4. Sample a y-value, 0< y < f(x0).
  5. Slice the curve horizontally at y.
  6. Sample a point (x,y) from within the line segment you just created.
  7. Repeat the steps.

Randomly select a slice that falls on or below the x-value from the previous iteration. This makes sure that the slices will be chosen with probabilities that are proportional to their segment lengths on the curve.


Bandyopadhyay, S. & Bhattacharya, R. (2014). Discrete and Continuous Simulation: Theory and Practice. CRC Press.
Huzurbazar, A. (2004). Flowgraph Models for Multistate Time-to-Event Data. John Wiley & Sons.
Neal (2003). Slice Sampling. Annals of Statistics. Volume 31, Number 3, 705-767.
Retrieved March 11, 2018 from:
Royle, J. et. al (2013). Spatial Capture-Recapture. Academic Press.


Need help with a specific statistics question? Chegg offers 30 minutes of free tutoring, so you can try them out before committing to a subscription. Click here for more details.

If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.

Comments are now closed for this post. Need to post a correction? Please post a comment on our Facebook page.
Slice Sampling: Simple Definition & Steps was last modified: March 11th, 2018 by Stephanie