# Turing equivalent of Stan/R model from StatisticalRethinking

**URL:** <https://discourse.julialang.org/t/turing-equivalent-of-stan-r-model-from-statisticalrethinking/72092>\
**Category:** General Usage\
**Created:** [November 26, 2021, 5:33am UTC](https://discourse.julialang.org/t/turing-equivalent-of-stan-r-model-from-statisticalrethinking/72092 "2021-11-26T05:33:08Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![trahflow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/trahflow/32/30585_2.png) [@trahflow](https://discourse.julialang.org/u/trahflow)\
**Post date:** [November 26, 2021, 3:26pm UTC](https://discourse.julialang.org/t/turing-equivalent-of-stan-r-model-from-statisticalrethinking/72092/5 "2021-11-26T15:26:57Z")

</div>

> [@amit1](#):
>
> What is Turing equivalent of `transpars` in STAN?

For that question see this discussion (tldr: There is a `generated_quantities()` function) :

> [@Traces of transformed variables within Turing.jl models](https://discourse.julialang.org/t/traces-of-transformed-variables-within-turing-jl-models/53013/7):
>
> Nice and thanks for the quick response @dlakelan! For future reference, here is the example from the [docs](https://docs.juliahub.com/DynamicPPL/2PWyN/0.10.16/autodocs/#DynamicPPL.generated_quantities-Tuple%7BModel,%20AbstractMCMC.AbstractChains%7D) using variational inference: using Turing using Optim using StatsPlots using Turing: Variational @model function demo(xs) s ~ InverseGamma(2, 3) m\_shifted ~ Normal(10, √s) m = m\_shifted - 10 for i in eachindex(xs) xs[i] ~ Normal(m, √s) end return (m, ) end q = vi(model, ADVI(10, 2000)) samples = rand(q, 1000) #NOTE: constructing the chain becomes sligh…

---

_[View the full topic](https://discourse.julialang.org/t/turing-equivalent-of-stan-r-model-from-statisticalrethinking/72092)._
