Hi Praveen, welcome to Discourse! This is a good question!
I just want to clarify: you need a joint prior on X and Y such that
- the margin for X is uniform between zero and two.
- additionally, for any value of X the pushforward for Y comes from uniform(X, 2)
- and as a result, you’re expecting the histogram of the margin for Y (without conditioning on X) that looks like a concave-up curve increasing beginning at (0,0).
Here are two Stan programs that achieve this:
Program 1
parameters {
real<lower = 0, upper = 2> X;
real<lower = 0, upper = 1> Y_1;
}
transformed parameters {
real Y = Y_1*(2 - X) + X;
}
Program 2:
parameters {
real<lower = 0, upper = 2> X;
real<lower = X, upper = 2> Y;
}
model {
target += -log(2 - X);
}
The intuition here is that rather than a uniform probability density over the triangle that respects your parameter constraints, we need a density such that slices along values of constant X all have the same total probability as one another. These slices differ in length from the slice at X = 0 by a factor of \frac{2 - X}{2}, and so these regions of parameter space need to contain excess probability density according to the reciprocal of this fraction. Dropping the constant 2 in the denominator and taking the logarithm we get the second model above.