# Probabilistic Programming

**URL:** https://discourse.julialang.org/c/domain/probprog/48.md?page=8

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 9

---

## [BoundsError on Bayesian ODE model with Turing](https://discourse.julialang.org/t/boundserror-on-bayesian-ode-model-with-turing/74147)

<div class="topic-metadata">

**Author:** [@spinystellate](https://discourse.julialang.org/u/spinystellate)\
**Replies:** 13\
**Last updated:** [March 24, 2022, 8:47am UTC](https://discourse.julialang.org/t/boundserror-on-bayesian-ode-model-with-turing/74147 "2022-03-24T08:47:53Z")

</div>

I posted this question here already: but unfortunately it has not attracted any responses, so I think it may be more appropriate in this category. (I did not seem to be able to edit the category in the original post.) …

---

## [How to run Stan diagnose binary using StanSample.jl](https://discourse.julialang.org/t/how-to-run-stan-diagnose-binary-using-stansample-jl/78304)

<div class="topic-metadata">

**Author:** [@Stephen\_Wild](https://discourse.julialang.org/u/Stephen_Wild)\
**Replies:** 3\
**Last updated:** [March 22, 2022, 11:59pm UTC](https://discourse.julialang.org/t/how-to-run-stan-diagnose-binary-using-stansample-jl/78304 "2022-03-22T23:59:58Z")

</div>

Hello, I am trying to run Stan’s diagnose binary on a model. Unfortunately, I am getting an error. Here is some reproducible code using the example bernoulli model. using StanSample, DataFrames ProjDir = @\_\_DIR\_\_ ber…

---

## [What kind of distribution should I use for binary variable and others](https://discourse.julialang.org/t/what-kind-of-distribution-should-i-use-for-binary-variable-and-others/77446)

<div class="topic-metadata">

**Author:** [@RickandMortyforever](https://discourse.julialang.org/u/RickandMortyforever)\
**Replies:** 1\
**Last updated:** [March 5, 2022, 9:40pm UTC](https://discourse.julialang.org/t/what-kind-of-distribution-should-i-use-for-binary-variable-and-others/77446 "2022-03-05T21:40:24Z")

</div>

Hi, Guys. I have a question about building linear model I’ve read some examples about linear model with continuos predictors. But I don’t know how to set prior distributions on the binary(boolean) or categorcal or ord…

---

## [Custom ChainRulesCore rrule with ReverseDiff](https://discourse.julialang.org/t/custom-chainrulescore-rrule-with-reversediff/77389)

<div class="topic-metadata">

**Author:** [@smharwood](https://discourse.julialang.org/u/smharwood)\
**Replies:** 2\
**Last updated:** [March 4, 2022, 2:50pm UTC](https://discourse.julialang.org/t/custom-chainrulescore-rrule-with-reversediff/77389 "2022-03-04T14:50:43Z")

</div>

I’m having trouble finding documentation to get ReverseDiff to use a custom adjoint defined using ChainRulesCore.rrule. MWE: import Zygote, ReverseDiff import ChainRulesCore function f(x) x'\*x end function ChainRulesC…

---

## [In Julia Turing: getting AssertionError: model isa Model](https://discourse.julialang.org/t/in-julia-turing-getting-assertionerror-model-isa-model/76927)

<div class="topic-metadata">

**Author:** [@rkmalaiya](https://discourse.julialang.org/u/rkmalaiya)\
**Replies:** 2\
**Last updated:** [February 25, 2022, 5:55pm UTC](https://discourse.julialang.org/t/in-julia-turing-getting-assertionerror-model-isa-model/76927 "2022-02-25T17:55:42Z")

</div>

Hi All, I am executing below code mentioned in the Turing.jl Guide. This code can be used to calculate likelihood for the Turing model. However I am getting below mentioned error. Please let me know what I may be doing …

---

## [Best practices for dealing with NaNs in multiple data set using Turing](https://discourse.julialang.org/t/best-practices-for-dealing-with-nans-in-multiple-data-set-using-turing/70423)

<div class="topic-metadata">

**Author:** [@99dB](https://discourse.julialang.org/u/99dB)\
**Replies:** 2\
**Last updated:** [February 23, 2022, 3:44pm UTC](https://discourse.julialang.org/t/best-practices-for-dealing-with-nans-in-multiple-data-set-using-turing/70423 "2022-02-23T15:44:01Z")

</div>

What is the best way to deal with NaNs in multiple data treatments when using Turing? For example, for this example tutorial from https://github.com/TuringLang/TuringTutorials/blob/master/tutorials/10-bayesian-different…

---

## [Turing, Ordered Variables, and the Dirichlet Distribution](https://discourse.julialang.org/t/turing-ordered-variables-and-the-dirichlet-distribution/76970)

<div class="topic-metadata">

**Author:** [@wc4wc4wc4](https://discourse.julialang.org/u/wc4wc4wc4)\
**Replies:** 0\
**Last updated:** [February 23, 2022, 1:25pm UTC](https://discourse.julialang.org/t/turing-ordered-variables-and-the-dirichlet-distribution/76970 "2022-02-23T13:25:52Z")

</div>

Hi all, I am trying to fit some diffusion data which we expect to be generated from two or more Rayleigh distributions. To make some data for the MWE, take the following example: function get\_data(; μ₁ = 1, μ₂ = 2, N …

---

## [How to use Bijectors.jl for model with simplex, am I doing right?](https://discourse.julialang.org/t/how-to-use-bijectors-jl-for-model-with-simplex-am-i-doing-right/76768)

<div class="topic-metadata">

**Author:** [@pleochroite](https://discourse.julialang.org/u/pleochroite)\
**Replies:** 4\
**Last updated:** [February 21, 2022, 4:49pm UTC](https://discourse.julialang.org/t/how-to-use-bijectors-jl-for-model-with-simplex-am-i-doing-right/76768 "2022-02-21T16:49:50Z")

</div>

Hello all, I am trying to translate a textbook written in R/Stan into Turing. Simple models such as logistic regression are easy for me to model. However, faced to advanced models with ordered/simplex constraints, I got…

---

## [Domain error for Turing model with callback](https://discourse.julialang.org/t/domain-error-for-turing-model-with-callback/75723)

<div class="topic-metadata">

**Author:** [@vembha](https://discourse.julialang.org/u/vembha)\
**Replies:** 33\
**Last updated:** [February 18, 2022, 6:06pm UTC](https://discourse.julialang.org/t/domain-error-for-turing-model-with-callback/75723 "2022-02-18T18:06:07Z")

</div>

Hello, Following is a moderately large Turing model, where the ODE system is solved for 51 time steps with a discrete callback at t=20. #====================================== PARAMETER ESTIMATION FROM SYNTHETIC DATA =…

---

## [Help with Jacobian vector product to get natural gradient](https://discourse.julialang.org/t/help-with-jacobian-vector-product-to-get-natural-gradient/51115)

<div class="topic-metadata">

**Author:** [@theogf](https://discourse.julialang.org/u/theogf)\
**Replies:** 16\
**Last updated:** [February 18, 2022, 12:15am UTC](https://discourse.julialang.org/t/help-with-jacobian-vector-product-to-get-natural-gradient/51115 "2022-02-18T00:15:53Z")

</div>

Hi I am trying to reproduce an algorithm based on Natural gradient computations (Natural Gradients in Practice - Salimbeni et al 2018). The key computation is that you can get rid of the inverse Fisher Information matr…

---

## [Can anyone give me an example of using Turing for sampling using metropolis hastings algorithm?](https://discourse.julialang.org/t/can-anyone-give-me-an-example-of-using-turing-for-sampling-using-metropolis-hastings-algorithm/76315)

<div class="topic-metadata">

**Author:** [@mirror63](https://discourse.julialang.org/u/mirror63)\
**Replies:** 2\
**Last updated:** [February 17, 2022, 12:55pm UTC](https://discourse.julialang.org/t/can-anyone-give-me-an-example-of-using-turing-for-sampling-using-metropolis-hastings-algorithm/76315 "2022-02-17T12:55:35Z")

</div>

I have a normal proposal distribution with mean 3 and variance 4. Can anyone give me an example of sampling using metropolis hastings algorithm?

---

## [Handling Dual types in my Turing model in a more elegant way](https://discourse.julialang.org/t/handling-dual-types-in-my-turing-model-in-a-more-elegant-way/76365)

<div class="topic-metadata">

**Author:** [@jacobusmmsmit](https://discourse.julialang.org/u/jacobusmmsmit)\
**Replies:** 3\
**Last updated:** [February 14, 2022, 2:17pm UTC](https://discourse.julialang.org/t/handling-dual-types-in-my-turing-model-in-a-more-elegant-way/76365 "2022-02-14T14:17:56Z")

</div>

Hello everyone, I’m doing inference on a system of ODEs solved with Rodas5. To use Rodas5 while writing inplace to my du, I check if one of u or du is a Dual so there’s no typeassert based errors. To use Turing with the…

---

## [Turing TypeErrror Issue](https://discourse.julialang.org/t/turing-typeerrror-issue/76032)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 4\
**Last updated:** [February 9, 2022, 7:26pm UTC](https://discourse.julialang.org/t/turing-typeerrror-issue/76032 "2022-02-09T19:26:29Z")

</div>

I’m experimenting with using Turing to handle some Gaussian random fields problems, and I’m struggling a bit with the interface. The following is supposed to do a Bayesian posterior sampling of the problem y= u(x\_i) +…

---

## [Setting up Turing.jl model for an astrophysics problem](https://discourse.julialang.org/t/setting-up-turing-jl-model-for-an-astrophysics-problem/75618)

<div class="topic-metadata">

**Author:** [@majoburo](https://discourse.julialang.org/u/majoburo)\
**Replies:** 2\
**Last updated:** [February 9, 2022, 4:45pm UTC](https://discourse.julialang.org/t/setting-up-turing-jl-model-for-an-astrophysics-problem/75618 "2022-02-09T16:45:05Z")

</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’…

---

## [Multinomial(::Int, ::Vector{Any}) error in Turing doing LDA](https://discourse.julialang.org/t/multinomial-int-vector-any-error-in-turing-doing-lda/76066)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 5\
**Last updated:** [February 9, 2022, 4:13pm UTC](https://discourse.julialang.org/t/multinomial-int-vector-any-error-in-turing-doing-lda/76066 "2022-02-09T16:13:30Z")

</div>

Hello, I’m trying to get my hands on Turing by implementing a Latent Dirichlet Allocation model from a youtube course I’m following. I implemented the following model: using Turing, Distributions @model function LDA(w…

---

## [Modeling gaussian process with Turing.jl](https://discourse.julialang.org/t/modeling-gaussian-process-with-turing-jl/76001)

<div class="topic-metadata">

**Author:** [@RickandMortyforever](https://discourse.julialang.org/u/RickandMortyforever)\
**Replies:** 6\
**Last updated:** [February 8, 2022, 11:08am UTC](https://discourse.julialang.org/t/modeling-gaussian-process-with-turing-jl/76001 "2022-02-08T11:08:42Z")

</div>

Hi, I was trying to build a gaussian process model with Turing.jl I’ve read Gaussianprocesses.jl and Stheno.jl. They must be good. But for the purpose of learning, I’d like to go through step by step in frame of Turing…

---

## [Poisson regression in Turing](https://discourse.julialang.org/t/poisson-regression-in-turing/75839)

<div class="topic-metadata">

**Author:** [@PeetoomHeida](https://discourse.julialang.org/u/PeetoomHeida)\
**Replies:** 2\
**Last updated:** [February 5, 2022, 4:54pm UTC](https://discourse.julialang.org/t/poisson-regression-in-turing/75839 "2022-02-05T16:54:21Z")

</div>

I am trying to modify the example Poisson regression to suit my own needs. I am running into an issue in the for loop and likelihood expression in the model definition. The following is my script: using DataFrames, Turi…

---

## [Need some help on sampler error with simple linear regression](https://discourse.julialang.org/t/need-some-help-on-sampler-error-with-simple-linear-regression/75805)

<div class="topic-metadata">

**Author:** [@RickandMortyforever](https://discourse.julialang.org/u/RickandMortyforever)\
**Replies:** 2\
**Last updated:** [February 5, 2022, 1:49am UTC](https://discourse.julialang.org/t/need-some-help-on-sampler-error-with-simple-linear-regression/75805 "2022-02-05T01:49:43Z")

</div>

After watching Statistical Rethinking lecture about linear regression, I tried to follow the steps with other data using Turing. Also I looked up this reference. GitHub - StatisticalRethinkingJulia/SR2TuringPluto.jl: St…

---

## [Turing.jl for Causal Inference model](https://discourse.julialang.org/t/turing-jl-for-causal-inference-model/75650)

<div class="topic-metadata">

**Author:** [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Replies:** 19\
**Last updated:** [February 4, 2022, 10:30am UTC](https://discourse.julialang.org/t/turing-jl-for-causal-inference-model/75650 "2022-02-04T10:30:06Z")

</div>

I am trying to translate the model from McElreath’s Causal Inference workshop (youtube, github) to Turing.jl and while the results seem to be the same I get much worse performance with Turing (3 sec. vs 110 sec.) so I wa…

---

## [Incorporating time lag in observation models](https://discourse.julialang.org/t/incorporating-time-lag-in-observation-models/75002)

<div class="topic-metadata">

**Author:** [@vembha](https://discourse.julialang.org/u/vembha)\
**Replies:** 3\
**Last updated:** [January 22, 2022, 12:57pm UTC](https://discourse.julialang.org/t/incorporating-time-lag-in-observation-models/75002 "2022-01-22T12:57:47Z")

</div>

Hello. I am estimating parameters of a simple SIR epidemic model (shown below) by fitting the model to a known time series data: Deterministic model: function SIR\_model(du, u, p, t) S, I, R = u β, γ = p du…

---

## [Turing with ODE model using dualcache causes error](https://discourse.julialang.org/t/turing-with-ode-model-using-dualcache-causes-error/74166)

<div class="topic-metadata">

**Author:** [@jacobusmmsmit](https://discourse.julialang.org/u/jacobusmmsmit)\
**Replies:** 1\
**Last updated:** [January 7, 2022, 6:58am UTC](https://discourse.julialang.org/t/turing-with-ode-model-using-dualcache-causes-error/74166 "2022-01-07T06:58:02Z")

</div>

I am running into a similar problem as this thread which unfortunately didn’t resolve the issue in my case. I think I am perhaps misusing dualcache in the definition of my update function and I would be grateful for any …

---

## [Turing model producing unexpected summary statistics](https://discourse.julialang.org/t/turing-model-producing-unexpected-summary-statistics/73312)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 2\
**Last updated:** [December 19, 2021, 2:25am UTC](https://discourse.julialang.org/t/turing-model-producing-unexpected-summary-statistics/73312 "2021-12-19T02:25:58Z")

</div>

I have a very simple Turing model where all variables are Normal or TruncatedNormal. For some reason, the summary statistics of the model are not the ones I expected. Can you please help with this MWE? using Turing usin…

---

## [Variational Inference of Mixture models?](https://discourse.julialang.org/t/variational-inference-of-mixture-models/40031)

<div class="topic-metadata">

**Author:** [@marty0801](https://discourse.julialang.org/u/marty0801)\
**Replies:** 8\
**Last updated:** [December 16, 2021, 10:06am UTC](https://discourse.julialang.org/t/variational-inference-of-mixture-models/40031 "2021-12-16T10:06:31Z")

</div>

I’m just cutting my teeth on Turing. (BTW, thanks for this amazing software.) Does Turing support VI of mixture models? I attempted advi against a gaussian mixture model, but without success as below. The error occurred…

---

## [Translating Binomial N-mixture models from Jags](https://discourse.julialang.org/t/translating-binomial-n-mixture-models-from-jags/72579)

<div class="topic-metadata">

**Author:** [@FolgertK](https://discourse.julialang.org/u/FolgertK)\
**Replies:** 8\
**Last updated:** [December 14, 2021, 1:50pm UTC](https://discourse.julialang.org/t/translating-binomial-n-mixture-models-from-jags/72579 "2021-12-14T13:50:31Z")

</div>

Hi there! I’m new to Julia and Turing, but I’m trying to translate some ecological models by Kéry and Royle (2016) from JAGS to Turing. The specific model here is a Binomial N-mixture model (or a Poisson-Binomal mixture…

---

## [Traces of transformed variables within Turing.jl models](https://discourse.julialang.org/t/traces-of-transformed-variables-within-turing-jl-models/53013)

<div class="topic-metadata">

**Author:** [@BradGroff](https://discourse.julialang.org/u/BradGroff)\
**Replies:** 7\
**Last updated:** [December 8, 2021, 7:33am UTC](https://discourse.julialang.org/t/traces-of-transformed-variables-within-turing-jl-models/53013 "2021-12-08T07:33:58Z")

</div>

Hi all, Is it possible to make Turing return the transformations of random variables in chains? For instance: @model function silly\_example(y) x ~ Beta(1,1) z = x \> 0.5 # This guy! y ~ Normal…

---

## [Probabilistic bone classification - is probabilistic graphical model good idea?](https://discourse.julialang.org/t/probabilistic-bone-classification-is-probabilistic-graphical-model-good-idea/72703)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 0\
**Last updated:** [December 7, 2021, 9:49am UTC](https://discourse.julialang.org/t/probabilistic-bone-classification-is-probabilistic-graphical-model-good-idea/72703 "2021-12-07T09:49:57Z")

</div>

Hello I want to create a probabilistic graphical model for bones classification from PET/CT scan with uncertainity quantification, but I am not sure is it good idea and how to start . So the general plan how I imagine i…

---

## [Compositional Sampling in Turing - getting exactly same samples (standard deviation is zero)](https://discourse.julialang.org/t/compositional-sampling-in-turing-getting-exactly-same-samples-standard-deviation-is-zero/72326)

<div class="topic-metadata">

**Author:** [@rkmalaiya](https://discourse.julialang.org/u/rkmalaiya)\
**Replies:** 13\
**Last updated:** [December 6, 2021, 8:09pm UTC](https://discourse.julialang.org/t/compositional-sampling-in-turing-getting-exactly-same-samples-standard-deviation-is-zero/72326 "2021-12-06T20:09:16Z")

</div>

Hello Everyone, I have just started to use Turing. I want to implement a DINA Model ( DINA Model and Parameter Estimation: A Didactic (jstor.org)) which contains both discrete and continuous random variables. Hence, I w…

---

## [Strange error from Turing.jl?](https://discourse.julialang.org/t/strange-error-from-turing-jl/68837)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 18\
**Last updated:** [December 5, 2021, 3:22pm UTC](https://discourse.julialang.org/t/strange-error-from-turing-jl/68837 "2021-12-05T15:22:13Z")

</div>

I’ve got the following model, and some data, I’m trying to get a posterior over the infection probability for vaxxed and unvaxxed in my simulated dataset: @model function vaxxdecision(data) pv ~ Beta(1,100) pu…

---

## [Target Variable is a Deterministic Function of Random Variables](https://discourse.julialang.org/t/target-variable-is-a-deterministic-function-of-random-variables/71935)

<div class="topic-metadata">

**Author:** [@Stephen2](https://discourse.julialang.org/u/Stephen2)\
**Replies:** 9\
**Last updated:** [November 29, 2021, 4:48pm UTC](https://discourse.julialang.org/t/target-variable-is-a-deterministic-function-of-random-variables/71935 "2021-11-29T16:48:29Z")

</div>

Crossposting this from “New to Julia” as I received no responses. Hi, I am new to Julia and struggling to formulate my model correctly. My model consists of: A regressor x\_t An intermediate variable y\_t = k \* x\_t + ϵ…

---

## [Using MixtureModels (from Distributions.jl) in Turing? Issues with posterior prediction](https://discourse.julialang.org/t/using-mixturemodels-from-distributions-jl-in-turing-issues-with-posterior-prediction/71617)

<div class="topic-metadata">

**Author:** [@opera\_malenky](https://discourse.julialang.org/u/opera_malenky)\
**Replies:** 2\
**Last updated:** [November 18, 2021, 3:48pm UTC](https://discourse.julialang.org/t/using-mixturemodels-from-distributions-jl-in-turing-issues-with-posterior-prediction/71617 "2021-11-18T15:48:23Z")

</div>

I am trying to fit a kernel mixture model in Turing. It seems to work for estimation, but gives an error when trying to use predict. I’d be curious if anyone has a suggestion for a fix. using Distributions, Turing # Un…

[Previous page](https://discourse.julialang.org/c/domain/probprog/48.md?page=7)

[Next page](https://discourse.julialang.org/c/domain/probprog/48.md?page=9)
