-
Notifications
You must be signed in to change notification settings - Fork 432
Description
Hi,
I am currently building a Turing.jl model and want to use the draw of one random variable as the bound for another one, using the truncated function.
While the usage does not throw an error, it definitely does not seem to work (see MWE below).
I already saw this other issue, yet it was only about using random variables as parameters for the distribution. The case for using the draw of a random variable as a bound still seems to be not working.
Am I doing something wrong, or is there another way I could achieve using one random variable as the bound for another one?
a = 0:.05:1
b = 2 .- 1.5 * a + randn(21)
@model function truncate_mwe(x, y)
intercept ~ truncated(Normal(0, 1), 0, Inf)
slope ~ truncated(Normal(0, 1), -intercept, Inf)
for i in eachindex(y)
y[i] ~ Normal(intercept + slope * x[i], 1)
end
end
chain_mwe = sample(truncate_mwe(a,b), NUTS(), 1000)For me, this chain always has some samples, for which intercept + slope < 0, which should not be the case as the maximum value for x in this case is 1.
Kind regards and thanks in advance for any help!