Skip to content

Dependent uniform variables not working correctly #2245

@evolbeginner

Description

@evolbeginner

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.

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions