This question came up here a few years ago:
I’m testing out Turing.jl and I’m wondering if I can specify a subset of parameters to remain fixed at their prior distribution. I would still like to sample these parameters to get a joint distribution with the other parameters that I do want the posterior for.
For example, say I have the following model. Can I specify β to remain at its prior distribution?
@model bayes_sir(y) = begin
# Calculate number of timepoints
l = length(y)
i₀ ~ Uniform(0.0,1.0)
β ~ Uniform(0.0,1.0)
…
See also this issue:
opened 05:24PM - 10 Jun 20 UTC
closed 07:20PM - 16 Dec 21 UTC
As per this discussion, https://discourse.julialang.org/t/turing-jl-fix-some-par… ameters-to-prior-distribution/41095/11, I would like to be able force some parameters to remain at their prior distribution and only perform inference on a subset of parameters. Could this be achieved by enabling `Prior` Gibbs for compositional sampling? For example to do inference on `a` but not on `b`:
```
chn = sample(model, Gibbs(NUTS(-1, 0.65, :a), Prior(:b)), 1000)
```
I’ve had cases where this would be really useful. There is a Prior()
sampler, but it doesn’t seem to have a method accepting a symbol to tell it which variables to apply it to inside a Gibbs sampler.
1 Like