Hello everybody,
as I want to switch from R to Julia for my Bayesian modelling, tonight I run my first models in Turing. However, I encountered some problems, principally when trying to model a random-intercept model.
The model is defined as follows:
@model my_regression(x, y, idx) = begin
α ~ Normal(mean(y), 2.5 * std(y))
β ~ Exponential(2)
σ ~ Exponential(1 / std(y))
n_gr = length(unique(idx))
τ ~ truncated(Cauchy(0, 1), 0, Inf) # group-level SDs intercepts
αⱼ ~ filldist(Normal(0, τ), n_gr) # group-level intercepts
ŷ = α .+ αⱼ[idx] .+ x * β
y ~ MvNormal(ŷ, σ)
end;
However, when running the model I receive the error no method matching MvNormal(::Matrix{Float64}, ::Float64)
.
A similar model without the group-level intercepts runs without any problems and uses @. y ~ Normal(exp(α + β1 * x), σ)
as a linear model. I suspect that a main reason for my problems could be due to a lack of understanding of the role of broadcasting, but I am really not sure.
Looking forward to your comments,
Tarotis