# Custom Sampler in Turing.jl

**URL:** <https://discourse.julialang.org/t/custom-sampler-in-turing-jl/40629>\
**Category:** Statistics\
**Tags:** question\
**Created:** [June 2, 2020, 7:02pm UTC](https://discourse.julialang.org/t/custom-sampler-in-turing-jl/40629 "2020-06-02T19:02:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdeonovic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bdeonovic/32/3928_2.png) [@bdeonovic](https://discourse.julialang.org/u/bdeonovic)\
**Post date:** [June 2, 2020, 7:02pm UTC](https://discourse.julialang.org/t/custom-sampler-in-turing-jl/40629/1 "2020-06-02T19:02:54Z")

</div>

Lets say I have some Bayesian model for which the full conditional distributions of some of the variables are known in closed form. How can I write the appropriate Gibbs sampler for these variables in Turing.jl?

Lets say I’m interested in the very simple model outlined in this example: [Tutorial — Mamba.jl 0.12.0 documentation](https://mambajl.readthedocs.io/en/latest/tutorial.html)

I haven’t been able to find any documentation for doing this in Turing.

---

<div class="post-metadata">

**Author:** ![cpfiffer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cpfiffer/32/208747_2.png) [@cpfiffer](https://discourse.julialang.org/u/cpfiffer)\
**Post date:** [June 2, 2020, 7:34pm UTC](https://discourse.julialang.org/t/custom-sampler-in-turing-jl/40629/2 "2020-06-02T19:34:40Z")

</div>

We have a PR open to allow this [here](https://github.com/TuringLang/Turing.jl/pull/1275), but it hasn’t yet been merged.

---

<div class="post-metadata">

**Author:** ![bdeonovic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bdeonovic/32/3928_2.png) [@bdeonovic](https://discourse.julialang.org/u/bdeonovic)\
**Post date:** [June 3, 2020, 4:04pm UTC](https://discourse.julialang.org/t/custom-sampler-in-turing-jl/40629/3 "2020-06-03T16:04:12Z")

</div>

This looks PERFECT. Can’t wait for the PR merge
