Hi, I’m just starting out with probabilistic programming in general and Turing.jl specifically, so I am still in the process of wrapping my head around the logic of it.

I want to build a simple model where a yes/no response is modelled given some parameter that I’m interested in fitting. The idea is that a person might have a prior expectation for some parameter that’s then combined with the evidence coming in, leading to a decision. The evidence should have an uncertainty associated with it, and I want to know what uncertainty explains the behavior.

Here’s a basic program, but it doesn’t work yet because I think it tries to fit one `b_guess`

value? That is just supposed to be an intermediary thing from combining the two distributions. `as`

and `bs`

are experimental variables.

```
model = @model function response_model(as, bs, responses)
# this is like a population wide hyperparameter
σ²_a = 0.1
# weak prior, this variable is the one of interest
σ²_b ~ truncated(Normal(0, 100), 0, Inf)
for i in eachindex(as)
a_dist = Normal(as[i], sqrt(σ²_a))
b_dist = Normal(bs[i], sqrt(σ²_b))
combined = combine_distributions(a_dist, b_dist)
# here's the problem, I just need b_guess as an intermediate thing, I don't want to fit it
b_guess ~ combined
# the guess vs the real b value is fed into the logistic function
p = logistic(b_guess - bs[i])
# and then into the bernoulli distribution
responses[i] ~ Bernoulli(p)
end
end
function combine_distributions(n1::Normal, n2::Normal)
t = 1 / n1.σ ^ 2
u = 1 / n2.σ ^ 2
m = n1.μ
n = n2.μ
Normal((t * m + u * n) / (t + u), sqrt(1 / (t + u)))
end
```