In the following code I want to sample two variables, X1 ~ Uniform(0,1) and X2 ~ Uniform(0,X1)
using Turing
@model function model()
X1 ~ Uniform(1e-5, 1)
X2 ~ Uniform(0, X1)
end
my_model = model(); sample(my_model, NUTS(), 10000)
The mean of X2 should be 0.25 but I got it varying a lot each time. I believe X2 is not sampled correctly. I don't see the problem if X2 ~ Normal(X1,1) or X2 ~ Exponential(X1). Does anyone know why this issue happens and why it's specific to uniform distribution? Thanks in advance.

