How to leverage conjugate priors

I have a Turing model that I’m using to estimate how evenly distributed some count variables of interest are. I’m using the concentration parameter of a symmetric Dirichlet distribution as a measure of evenness. A simplified version of the model (removing hierarchical structure, treatment groups, repeated measures) is as follows:

@model function Mod(data)

    alpha ~ truncated(Normal (1,20),0,Inf)

    probs ~ Dirichlet (5, alpha)

    data ~ Multinomial(sum(data),probs)

end

Is there a way to avoid sampling “probs” at each iteration, given that Dirichlet is conjugate to multinomial. But still sample alpha and the rest of the model (not shown, for simplicity)?

I am happy to try non-Turing solutions.

1 Like

There’s a Beta-Binomial here:
https://juliastats.org/Distributions.jl/latest/univariate/#Distributions.BetaBinomial

I’d think what you want is a Dirichlet-Multinomial, effectively the multivariate version of this. So one approach would be to build this separately and then use it in Turing.

We’ll be adding this sort of thing to MeasureTheory.jl, but it’s not there yet.

1 Like

Thanks. Seems they already have it on Distributions.jl https://github.com/JuliaStats/Distributions.jl/blob/master/src/multivariate/dirichletmultinomial.jl