# Obtain the prior distribution for a function's parameter

**URL:** https://discourse.julialang.org/t/obtain-the-prior-distribution-for-a-functions-parameter/131677
**Category:** Statistics
**Tags:** distributions
**Created:** [August 18, 2025, 12:55pm UTC](https://discourse.julialang.org/t/obtain-the-prior-distribution-for-a-functions-parameter/131677 "2025-08-18T12:55:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Cyan](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@Cyan](https://discourse.julialang.org/u/Cyan)
#### Post date: [August 18, 2025, 12:55pm UTC](https://discourse.julialang.org/t/obtain-the-prior-distribution-for-a-functions-parameter/131677/1 "2025-08-18T12:55:07Z")

</div>

Hi, all. I met a problem getting the prior distribution for parameters in a function `f(x; b, s, q)`. I wish to obtain a dict `ParaDict = Dict(:b => b, :s => s, :q => q)` in form of

```julia-auto
b ~ truncated(Normal(1., 1), 0, 5)
s ~ truncated(Normal(0., 1), 0, 0.1)
q ~ truncated(Normal(0.5, 1.0), 0.1, 1)

    
ParaDict = Dict(:b => b, :s => s, :q => q)

```

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [August 18, 2025, 1:59pm UTC](https://discourse.julialang.org/t/obtain-the-prior-distribution-for-a-functions-parameter/131677/2 "2025-08-18T13:59:56Z")

</div>

Priors (in Bayesian estimation) are chosen by the statistician. Your question does not make sense in this form.

Is this a homework problem?

---

<div class="post-metadata">

### Author: ![Cyan](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@Cyan](https://discourse.julialang.org/u/Cyan)
#### Post date: [August 18, 2025, 2:06pm UTC](https://discourse.julialang.org/t/obtain-the-prior-distribution-for-a-functions-parameter/131677/3 "2025-08-18T14:06:56Z")

</div>

No, the prior is fixed as `truncated(Normal(m, sigma), lower, upper)`. I just don’t know how to make

```julia-auto
b ~ truncated(Normal(1., 1), 0, 5); 
Dict(:b =>b)

```

from `b` in `f(x;b)`

---

<div class="post-metadata">

### Author: ![lunafazio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lunafazio/32/217332_2.png) [@lunafazio](https://discourse.julialang.org/u/lunafazio)
#### Post date: [August 18, 2025, 5:50pm UTC](https://discourse.julialang.org/t/obtain-the-prior-distribution-for-a-functions-parameter/131677/4 "2025-08-18T17:50:23Z")

</div>

I feel like there’s something missing context in your question. In general, a function `f` may have nothing to do with priors at all or express it in some arbitrarily convoluted way that cannot be easily extracted.

I’m assuming the context for this is that the function is one defined through the use of the `@model` macro from `Turing.jl`? If not, you will need to give more information, ideally with a full example of the function you would like to extract that information from.
