# Fixed distribution in Turing

**URL:** <https://discourse.julialang.org/t/fixed-distribution-in-turing/103540>\
**Category:** General Usage\
**Tags:** turing\
**Created:** [September 5, 2023, 12:22pm UTC](https://discourse.julialang.org/t/fixed-distribution-in-turing/103540 "2023-09-05T12:22:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ElOceanografo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eloceanografo/32/624_2.png) [@ElOceanografo](https://discourse.julialang.org/u/ElOceanografo)\
**Post date:** [September 6, 2023, 12:26am UTC](https://discourse.julialang.org/t/fixed-distribution-in-turing/103540/2 "2023-09-06T00:26:01Z")

</div>

This question came up here a few years ago:

> [@Turing.jl: fix some parameters to prior distribution](https://discourse.julialang.org/t/turing-jl-fix-some-parameters-to-prior-distribution/41095):
>
> 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:

> <https://github.com/TuringLang/Turing.jl/issues/1321>
>
> 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.

---

_[View the full topic](https://discourse.julialang.org/t/fixed-distribution-in-turing/103540)._
