Previously, I looked at some simple slice sampling algorithms that were appropriate for unimodal posteriors. Here are some more general slice sampling algortihms based on the Slice sampling paper from Neal (2003). The two algorithms here are the stepping-out and doubling samplers.

## Stepping-out slice sampler

The idea here is to build an interval around the currently sampled value and then sample uniformly in the interval until a sample is obtained where the target evaluated at the proposed value is larger than the slice auxiliary variable. There is a tuning parameter w that is the initial interval width and the interval is constructed by

1. Randomly placing the interval over the current value.
2. Stepping out from the L and R endpoints of the interval until the target is lower than the slice.

The maximum number of steps taken can be controlled. ## Doubling slice sampler

The doubling slice sampler has the same idea except that rather than adding a fixed width to the interval every time, the width of the interval is doubled in size either to the right or to the left. Given the tuning parameter w that determines the original interval width, the interval is constructed by

1. Randomly placing the interval over the current value.
2. Doubling the size of the interval randomly to either the right or left until both sides have the target less than the slice variable.

The maximum number of doublings can be controlled.

The doubling procedure can be more efficient if w was chosen too small as it attains a larger interval in the same number of steps. This efficiency comes at the cost of an additional check when trying to accept a proposed value. From the manuscript

This procedure works backward through the intervals that the doubling procedure would pass through to arrive at [the doubled interval] when starting from the new point, checking that none of [the intermediate intervals] has both ends outside the slice, which would lead to earlier termination of the doubling procedure.

The function to perform this check is ‘accept’.

Now, we have the doubling slice sampler which looks very similar to the stepping-out slice sampler. 