Hi @njzifjoiez,
I was informed (by ChatGPT) that stepping out is actually not necessary in slice sampling, and not doing it does not cause a bias. However, one needs to make the proposal reversible. Neal2003's slice sampling does this by randomizing the location of the current point on the slice (not set it to be at zero.
This small modification should let us have the cake and eat it too -- avoiding stepping out, but without a bias.
Would you be able to make the change and test it?
Here are the instructions I got:
-
Compute the line’s allowable t-range from the unit cube:
(tmin, tmax) = unitcube_line_intersection(u0, v)
-
Choose the working width w:
w = min(2*scale*factor_scale, tmax - tmin)
-
Randomize the initial bracket so that it contains t0 = 0, has width w, and lies within [tmin, tmax]:
u = Uniform(0,1)
L = max(tmin, -u*w)
R = L + w
if R > tmax:
R = tmax
L = R - w
Now ensure t0=0 is inside [L, R]. Given tmin <= 0 <= tmax and w <= tmax - tmin, this holds.
- Initialize both worker and point bounds to that randomized [L, R]:
tleft_worker = tleft = L
tright_worker = tright = R
- Proceed with the usual shrinkage on rejections with shrink_factor = 1.0.
related to: #118
Hi @njzifjoiez,
I was informed (by ChatGPT) that stepping out is actually not necessary in slice sampling, and not doing it does not cause a bias. However, one needs to make the proposal reversible. Neal2003's slice sampling does this by randomizing the location of the current point on the slice (not set it to be at zero.
This small modification should let us have the cake and eat it too -- avoiding stepping out, but without a bias.
Would you be able to make the change and test it?
Here are the instructions I got:
Compute the line’s allowable t-range from the unit cube:
(tmin, tmax) = unitcube_line_intersection(u0, v)Choose the working width w:
w = min(2*scale*factor_scale, tmax - tmin)Randomize the initial bracket so that it contains t0 = 0, has width w, and lies within [tmin, tmax]:
Now ensure t0=0 is inside [L, R]. Given tmin <= 0 <= tmax and w <= tmax - tmin, this holds.
related to: #118