# Setting up Turing.jl model for an astrophysics problem

**URL:** <https://discourse.julialang.org/t/setting-up-turing-jl-model-for-an-astrophysics-problem/75618>\
**Category:** Probabilistic Programming\
**Tags:** question\
**Created:** [February 2, 2022, 2:40am UTC](https://discourse.julialang.org/t/setting-up-turing-jl-model-for-an-astrophysics-problem/75618 "2022-02-02T02:40:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![majoburo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/majoburo/32/33409_2.png) [@majoburo](https://discourse.julialang.org/u/majoburo)\
**Post date:** [February 2, 2022, 2:40am UTC](https://discourse.julialang.org/t/setting-up-turing-jl-model-for-an-astrophysics-problem/75618/1 "2022-02-02T02:40:45Z")

</div>

Hi guys,

I’m new to using Julia and Turing.jl. A friend recommended I ask about this here.  
I’m trying to model the dispersion of the stellar orbits around the supermassive black hole at the center of the Milky Way.  
I’m not quite sure how to set up Turing for this kind of inference, and I didn’t see any similar examples in the docs.

Here is a schematic Turing model for what I’m trying to do. Could you please tell me if there’s something evidently wrong, or if I’m totally off-base, if there’s a better way to about it?

```julia
@model toymodel(data1, data1error, data2, data2error) = begin
    # Priors for the parameter we want to constrain
    A ~ Uniform(1.0,2.0)
    
    #Our model does a forward prediction of the mean of the 
    #distribution of some_function_of(nuisance2).
    #We don't know the standard deviation, but we intend to margnialize over it.
    predicted_mean = markovian_model_prediction(A, nuisance1)
    some_function_of(nuisance2) ~ LogNormal(predicted_mean, unknown_std)

    # Introducing the statistical error asociated with each measured parameter.
    N = length(data2)
    for i in 1:N
        data2[i] ~ Normal(nuisance2[i], data2error[i])
        data1[i] ~ Normal(nuisance1[i], data1error[i])
    end

end

```

---

<div class="post-metadata">

**Author:** ![martinmestre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinmestre/32/215857_2.png) [@martinmestre](https://discourse.julialang.org/u/martinmestre)\
**Post date:** [February 3, 2022, 12:45pm UTC](https://discourse.julialang.org/t/setting-up-turing-jl-model-for-an-astrophysics-problem/75618/2 "2022-02-03T12:45:36Z")

</div>

Hi @majoburo !  
I am happy to have read your post although I do not have the answer. I work in a very close topic to yours as shown [here](https://ui.adsabs.harvard.edu/abs/2021MNRAS.tmpL.114A/abstract). Also, I have began a related project in Julia using differential equations and optimizations. I am interested in your project so, if you want to join forces, please contact me at my email: mmestre@fcaglp.unlp.edu.ar  
All the best.

---

<div class="post-metadata">

**Author:** ![sethaxen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sethaxen/32/35604_2.png) [@sethaxen](https://discourse.julialang.org/u/sethaxen)\
**Post date:** [February 9, 2022, 4:45pm UTC](https://discourse.julialang.org/t/setting-up-turing-jl-model-for-an-astrophysics-problem/75618/3 "2022-02-09T16:45:05Z")

</div>

> [@majoburo](#):
>
> ```julia
> #Our model does a forward prediction of the mean of the 
> #distribution of some_function_of(nuisance2).
> #We don't know the standard deviation, but we intend to margnialize over it.
> predicted_mean = markovian_model_prediction(A, nuisance1)
> some_function_of(nuisance2) ~ LogNormal(predicted_mean, unknown_std)
> 
> ```

Can you tell us a little more about what’s going on here? Where do `nuisance1` and `nuisance2` come from? Are they sampled parameters that will be declared in your model?
