# Probabilistic Programming

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

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

**Page:** 10

---

## [Turing: help speed up state space model](https://discourse.julialang.org/t/turing-help-speed-up-state-space-model/64234)

<div class="topic-metadata">

**Author:** [@Stephen\_Wild](https://discourse.julialang.org/u/Stephen_Wild)\
**Replies:** 3\
**Last updated:** [November 11, 2021, 1:03pm UTC](https://discourse.julialang.org/t/turing-help-speed-up-state-space-model/64234 "2021-11-11T13:03:27Z")

</div>

Hello all. I am trying to use Turing to run a state space model based on Simon Jackman’s Bayesian Analysis for the Social Sciences. In chapter 9, he sets out a few different latent variable models, including a state spa…

---

## [New Soss interface - request for feedback](https://discourse.julialang.org/t/new-soss-interface-request-for-feedback/65118)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 8\
**Last updated:** [November 6, 2021, 4:00pm UTC](https://discourse.julialang.org/t/new-soss-interface-request-for-feedback/65118 "2021-11-06T16:00:26Z")

</div>

Hi, I’m working on extending Soss, and hoping I might get some design feedback. In the current release of Soss, a model is restricted to be a DAG. To do this, each line of the body of a model is required to be either of…

---

## [Incorporating forcing functions in the ODE model](https://discourse.julialang.org/t/incorporating-forcing-functions-in-the-ode-model/70133)

<div class="topic-metadata">

**Author:** [@vembha](https://discourse.julialang.org/u/vembha)\
**Replies:** 28\
**Last updated:** [November 1, 2021, 2:15am UTC](https://discourse.julialang.org/t/incorporating-forcing-functions-in-the-ode-model/70133 "2021-11-01T02:15:01Z")

</div>

Hello, I am new to Turing and Julia, and need some help! I have been trying to estimate the parameters of a model with a discrete forcing function q(t), where the values of q(t) are discrete and are read from a file. C…

---

## [Error running bym2 model](https://discourse.julialang.org/t/error-running-bym2-model/70394)

<div class="topic-metadata">

**Author:** [@Stephen\_Wild](https://discourse.julialang.org/u/Stephen_Wild)\
**Replies:** 0\
**Last updated:** [October 26, 2021, 9:59am UTC](https://discourse.julialang.org/t/error-running-bym2-model/70394 "2021-10-26T09:59:54Z")

</div>

I am trying to fit a Besag York Mollié (BYM) along the lines of this Stan case study. However, I have encountered an issue fitting the model. I hope someone can help me out to figure out what has gone wrong (I am almost …

---

## [Packages to compute model evidence in the Julia MCMC ecosystem?](https://discourse.julialang.org/t/packages-to-compute-model-evidence-in-the-julia-mcmc-ecosystem/68922)

<div class="topic-metadata">

**Author:** [@sami1](https://discourse.julialang.org/u/sami1)\
**Replies:** 5\
**Last updated:** [October 24, 2021, 5:14pm UTC](https://discourse.julialang.org/t/packages-to-compute-model-evidence-in-the-julia-mcmc-ecosystem/68922 "2021-10-24T17:14:30Z")

</div>

Hi, I’m interested in estimating model evidence (marginal likelihood) for probabilistic models (using the DynamicPPL framework, but let me know if there is something on this matter with Soss.jl). The only available solu…

---

## [Estimate posterior distribution of initial condition(s)](https://discourse.julialang.org/t/estimate-posterior-distribution-of-initial-condition-s/70139)

<div class="topic-metadata">

**Author:** [@vembha](https://discourse.julialang.org/u/vembha)\
**Replies:** 4\
**Last updated:** [October 21, 2021, 4:58pm UTC](https://discourse.julialang.org/t/estimate-posterior-distribution-of-initial-condition-s/70139 "2021-10-21T16:58:41Z")

</div>

Hello, I understood how the defining of prior distributions to parameter values and estimating the posterior distributions works using Turing. But, I was wondering if there is a way to estimate the posterior distributio…

---

## [FFTs in probabilistic models](https://discourse.julialang.org/t/ffts-in-probabilistic-models/69775)

<div class="topic-metadata">

**Author:** [@bdecost](https://discourse.julialang.org/u/bdecost)\
**Replies:** 5\
**Last updated:** [October 15, 2021, 3:19am UTC](https://discourse.julialang.org/t/ffts-in-probabilistic-models/69775 "2021-10-15T03:19:55Z")

</div>

I’m working on a model that involves a Fourier transform, and I’m running the limits of my julia debugging ability I’m using this AbstractFFTs PR to try to get it working with the ForwardDiff backend. (Zygote fails with…

---

## [Issues with HMC/NUTS samplers](https://discourse.julialang.org/t/issues-with-hmc-nuts-samplers/68900)

<div class="topic-metadata">

**Author:** [@tchebycheff](https://discourse.julialang.org/u/tchebycheff)\
**Replies:** 4\
**Last updated:** [September 29, 2021, 3:53pm UTC](https://discourse.julialang.org/t/issues-with-hmc-nuts-samplers/68900 "2021-09-29T15:53:41Z")

</div>

Hi - I am trying to run MCMC on this model with Turing. Only SMC sampler works. With HMC, NUTS, PG, DynamicHMC I get the error TypeError: in typeassert, expected Float64, got a value of type ForwardDiff.Dual{Nothing, F…

---

## [Broadcasting Imputed Values](https://discourse.julialang.org/t/broadcasting-imputed-values/68897)

<div class="topic-metadata">

**Author:** [@WawerOS](https://discourse.julialang.org/u/WawerOS)\
**Replies:** 0\
**Last updated:** [September 29, 2021, 1:10am UTC](https://discourse.julialang.org/t/broadcasting-imputed-values/68897 "2021-09-29T01:10:32Z")

</div>

Hello, I’m new to Turing so this might just be a beginners error but when I try following code using Turing @model function gdemo(x, y) s² ~ InverseGamma(2, 3) m ~ Normal(0, sqrt(s²)) x .~ Normal(m, sqrt(s…

---

## [Regime-switching Model in Turing.jl](https://discourse.julialang.org/t/regime-switching-model-in-turing-jl/68614)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 1\
**Last updated:** [September 23, 2021, 5:07pm UTC](https://discourse.julialang.org/t/regime-switching-model-in-turing-jl/68614 "2021-09-23T17:07:46Z")

</div>

Is it possible to replicate this Stan model in Turing.jl? https://khakieconomics.github.io/2018/02/24/Regime-switching-models.html

---

## [Turing.jl or SciML?: training and testing on different datasets](https://discourse.julialang.org/t/turing-jl-or-sciml-training-and-testing-on-different-datasets/68330)

<div class="topic-metadata">

**Author:** [@James\_Gorman](https://discourse.julialang.org/u/James_Gorman)\
**Replies:** 0\
**Last updated:** [September 17, 2021, 12:23pm UTC](https://discourse.julialang.org/t/turing-jl-or-sciml-training-and-testing-on-different-datasets/68330 "2021-09-17T12:23:04Z")

</div>

I am new to doing Bayesian inference, so I wanted to start off with doing a simple regression (here, assumed to be a linear regression). I decided to use Turing.jl, and through the tutorials and previous questions I was …

---

## [Fitting a observed value to a Binomial Distribution Turing](https://discourse.julialang.org/t/fitting-a-observed-value-to-a-binomial-distribution-turing/66619)

<div class="topic-metadata">

**Author:** [@jonathan\_skai](https://discourse.julialang.org/u/jonathan_skai)\
**Replies:** 3\
**Last updated:** [September 10, 2021, 4:04pm UTC](https://discourse.julialang.org/t/fitting-a-observed-value-to-a-binomial-distribution-turing/66619 "2021-09-10T16:04:57Z")

</div>

I am new to Turing and trying to learn it by trying to replicate the Chapters from the book :- https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers . Here is my problem (from Ch…

---

## [PG fails to sample properly with acclogp!](https://discourse.julialang.org/t/pg-fails-to-sample-properly-with-acclogp/67924)

<div class="topic-metadata">

**Author:** [@sami1](https://discourse.julialang.org/u/sami1)\
**Replies:** 2\
**Last updated:** [September 9, 2021, 3:33pm UTC](https://discourse.julialang.org/t/pg-fails-to-sample-properly-with-acclogp/67924 "2021-09-09T15:33:49Z")

</div>

Hello, I’m currently trying to sample from a posterior with a mixture of differentiable and discrete parameters, some of them I can’t marginalize. I tried to marginalize the one I could using acclogp!, and sample the re…

---

## [Normal Inverse Gaussian distribution in Turing](https://discourse.julialang.org/t/normal-inverse-gaussian-distribution-in-turing/67831)

<div class="topic-metadata">

**Author:** [@robertdj](https://discourse.julialang.org/u/robertdj)\
**Replies:** 0\
**Last updated:** [September 7, 2021, 8:00pm UTC](https://discourse.julialang.org/t/normal-inverse-gaussian-distribution-in-turing/67831 "2021-09-07T20:00:26Z")

</div>

I’m trying to use Turing to do inference for a Normal-Inverse-Gaussian (NIG) distribution, but I have two problems: I can only make the inference work for certain realizations. The parameter restriction feels clumsy. M…

---

## [Converting a BUGS model to Turing, simple linear regression](https://discourse.julialang.org/t/converting-a-bugs-model-to-turing-simple-linear-regression/67340)

<div class="topic-metadata">

**Author:** [@areding](https://discourse.julialang.org/u/areding)\
**Replies:** 5\
**Last updated:** [August 31, 2021, 2:56am UTC](https://discourse.julialang.org/t/converting-a-bugs-model-to-turing-simple-linear-regression/67340 "2021-08-31T02:56:12Z")

</div>

Hello everyone, I’m thinking about translating a course that focuses on WinBUGS to Turing so the students can use something a little more modern if they want. I’m new to Julia and Turing. Here is the WinBUGS model: fo…

---

## [Need some help converting JAGS code into Turing Model](https://discourse.julialang.org/t/need-some-help-converting-jags-code-into-turing-model/64173)

<div class="topic-metadata">

**Author:** [@stochastic\_guy](https://discourse.julialang.org/u/stochastic_guy)\
**Replies:** 3\
**Last updated:** [August 23, 2021, 8:14pm UTC](https://discourse.julialang.org/t/need-some-help-converting-jags-code-into-turing-model/64173 "2021-08-23T20:14:12Z")

</div>

I am trying to implement this JAGS model in Turing. JAGS code from: Zhan, P., Jiao, H., Man, K., & Wang, L. (2019). Using JAGS for Bayesian cognitive diagnosis modeling: A tutorial. Journal of Educational and Behav…

---

## [EBFMI with Turing](https://discourse.julialang.org/t/ebfmi-with-turing/66593)

<div class="topic-metadata">

**Author:** [@sijo](https://discourse.julialang.org/u/sijo)\
**Replies:** 0\
**Last updated:** [August 18, 2021, 10:47am UTC](https://discourse.julialang.org/t/ebfmi-with-turing/66593 "2021-08-18T10:47:25Z")

</div>

When sampling with NUTS in Turing, is there a way to get the EBFMI estimate? It seems to be implemented by the sample method in AdvancedHMC but can I get this information when sampling through Turing?

---

## [Multi-level varying slopes with two clusters, cross classification](https://discourse.julialang.org/t/multi-level-varying-slopes-with-two-clusters-cross-classification/62036)

<div class="topic-metadata">

**Author:** [@Neal](https://discourse.julialang.org/u/Neal)\
**Replies:** 16\
**Last updated:** [August 14, 2021, 8:35am UTC](https://discourse.julialang.org/t/multi-level-varying-slopes-with-two-clusters-cross-classification/62036 "2021-08-14T08:35:26Z")

</div>

Hello, I am working through StatisticalRethinking books with multi-level varying slopes with two clusters, cross classification model I run the stan model which finished sampling about two minutes. To build the mod…

---

## [Julia v1.7.0-beta3 installs old Turing version](https://discourse.julialang.org/t/julia-v1-7-0-beta3-installs-old-turing-version/66185)

<div class="topic-metadata">

**Author:** [@stst](https://discourse.julialang.org/u/stst)\
**Replies:** 4\
**Last updated:** [August 11, 2021, 4:53pm UTC](https://discourse.julialang.org/t/julia-v1-7-0-beta3-installs-old-turing-version/66185 "2021-08-11T16:53:57Z")

</div>

\] add Turing in the REPL of a fresh Julia v1.7.0-beta3 install on Windows with an emtpy .julia folder installs Turing v0.15.1 instead of the most recent v0.17.0. \] add Turing@v0.17.0 results in an unsatisfiable requirem…

---

## [Turning a function into distrubution for turing](https://discourse.julialang.org/t/turning-a-function-into-distrubution-for-turing/66016)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 0\
**Last updated:** [August 8, 2021, 11:54am UTC](https://discourse.julialang.org/t/turning-a-function-into-distrubution-for-turing/66016 "2021-08-08T11:54:39Z")

</div>

I have a target function that I want to transform into distribution in order to use Turing, let’s suppose that the target function is written on this form: logtarget(x::Vector)= log(prod(x))^2 how can I turn it into d…

---

## [My Turing.jl models](https://discourse.julialang.org/t/my-turing-jl-models/65258)

<div class="topic-metadata">

**Author:** [@Hakan\_Kjellerstrand](https://discourse.julialang.org/u/Hakan_Kjellerstrand)\
**Replies:** 2\
**Last updated:** [July 26, 2021, 4:36pm UTC](https://discourse.julialang.org/t/my-turing-jl-models/65258 "2021-07-26T16:36:03Z")

</div>

I have now finished porting most of my WebPPL and BLOG models to Turing.jl. They are collected at My Julia Turing.jl (probabilistic programming) page and also available at my GitHub page: https://github.com/hakank/hakank…

---

## [Turing.jl: Sometimes this error is thrown: Cannot \`convert\` an object of type Geometric{Float64} to an object of type Dirac{Float64}](https://discourse.julialang.org/t/turing-jl-sometimes-this-error-is-thrown-cannot-convert-an-object-of-type-geometric-float64-to-an-object-of-type-dirac-float64/65202)

<div class="topic-metadata">

**Author:** [@Hakan\_Kjellerstrand](https://discourse.julialang.org/u/Hakan_Kjellerstrand)\
**Replies:** 4\
**Last updated:** [July 24, 2021, 5:00am UTC](https://discourse.julialang.org/t/turing-jl-sometimes-this-error-is-thrown-cannot-convert-an-object-of-type-geometric-float64-to-an-object-of-type-dirac-float64/65202 "2021-07-24T05:00:51Z")

</div>

Sometimes, but not always, this error is thrown for the model below when using the SMC() sampler: ERROR: LoadError: CTaskException: MethodError: Cannot \`convert\` an object of type Geometric{Float64} to an object of type…

---

## [Turing.jl: UniformDraw distribution?](https://discourse.julialang.org/t/turing-jl-uniformdraw-distribution/65123)

<div class="topic-metadata">

**Author:** [@Hakan\_Kjellerstrand](https://discourse.julialang.org/u/Hakan_Kjellerstrand)\
**Replies:** 2\
**Last updated:** [July 23, 2021, 4:55am UTC](https://discourse.julialang.org/t/turing-jl-uniformdraw-distribution/65123 "2021-07-23T04:55:20Z")

</div>

Is there a “UniformDraw” distribution in Turing.jl / Distributions.jl, i.e. given an array of element, the distribution selects one of the elements randomly. Example: x = \[1,10,32,100\] val ~ UniformDraw(x) val is then…

---

## [Using nlsolve inside Turing.jl- ForwardDiff.Dual type error](https://discourse.julialang.org/t/using-nlsolve-inside-turing-jl-forwarddiff-dual-type-error/64986)

<div class="topic-metadata">

**Author:** [@stefan\_petrov\_123](https://discourse.julialang.org/u/stefan_petrov_123)\
**Replies:** 2\
**Last updated:** [July 22, 2021, 11:45pm UTC](https://discourse.julialang.org/t/using-nlsolve-inside-turing-jl-forwarddiff-dual-type-error/64986 "2021-07-22T23:45:46Z")

</div>

Hi, I’m trying to assess if Turing is a good fit for a particular dynamic pricing-type problem I have, and I’m wondering if it’s possible to use nlsolve inside. I’m sure it is, but I can’t figure it out. The code bello…

---

## [Help with Turing.jl: BetaBinomial ArgumentError: BetaBinomial: the condition n \>= zero(n) && (α \>= zero(α) && β \>= zero(β)) is not satisfied](https://discourse.julialang.org/t/help-with-turing-jl-betabinomial-argumenterror-betabinomial-the-condition-n-zero-n-zero-zero-is-not-satisfied/64929)

<div class="topic-metadata">

**Author:** [@wc4wc4wc4](https://discourse.julialang.org/u/wc4wc4wc4)\
**Replies:** 7\
**Last updated:** [July 22, 2021, 1:39pm UTC](https://discourse.julialang.org/t/help-with-turing-jl-betabinomial-argumenterror-betabinomial-the-condition-n-zero-n-zero-zero-is-not-satisfied/64929 "2021-07-22T13:39:52Z")

</div>

New to Julia, but have had my looks on it for a while now and finally got a bit of extra time during the Summer the play around with it, wuhuu! My goal is to implement a small program that I already have running in Pyth…

---

## [Help with Turing.jl model using Categorical, Normal and ordered constraint](https://discourse.julialang.org/t/help-with-turing-jl-model-using-categorical-normal-and-ordered-constraint/64765)

<div class="topic-metadata">

**Author:** [@Hakan\_Kjellerstrand](https://discourse.julialang.org/u/Hakan_Kjellerstrand)\
**Replies:** 2\
**Last updated:** [July 16, 2021, 9:05pm UTC](https://discourse.julialang.org/t/help-with-turing-jl-model-using-categorical-normal-and-ordered-constraint/64765 "2021-07-16T21:05:06Z")

</div>

I’m trying to model AllenDowney’s three problems “How tall is A?” (How tall is A? – Probably Overthinking It ): 1) Suppose you meet an adult resident of the U.S. who is 170 cm tall. What is the probability that th…

---

## [Turing.jl: Warnings when running generated\_quantities](https://discourse.julialang.org/t/turing-jl-warnings-when-running-generated-quantities/64698)

<div class="topic-metadata">

**Author:** [@Hakan\_Kjellerstrand](https://discourse.julialang.org/u/Hakan_Kjellerstrand)\
**Replies:** 2\
**Last updated:** [July 15, 2021, 3:57pm UTC](https://discourse.julialang.org/t/turing-jl-warnings-when-running-generated-quantities/64698 "2021-07-15T15:57:52Z")

</div>

When calling generated\_quantities there is always a huge number of warnings with the following message Warning: the following keys were not found in \`vi\`, and thus \`kernel!\` was not applied to these: \["lp"\] └ @ DynamicP…

---

## [Constrained parameters in Turing](https://discourse.julialang.org/t/constrained-parameters-in-turing/64086)

<div class="topic-metadata">

**Author:** [@Elmo](https://discourse.julialang.org/u/Elmo)\
**Replies:** 3\
**Last updated:** [July 8, 2021, 7:40pm UTC](https://discourse.julialang.org/t/constrained-parameters-in-turing/64086 "2021-07-08T19:40:55Z")

</div>

Hi all, Is it possible to set up a model in Turing so that the posterior distribution of some parameters satisfy a set of constraints? For example, suppose I want to do linear regression, but from physical principles I…

---

## [Turing model that records objective function values](https://discourse.julialang.org/t/turing-model-that-records-objective-function-values/64167)

<div class="topic-metadata">

**Author:** [@pthompson234](https://discourse.julialang.org/u/pthompson234)\
**Replies:** 0\
**Last updated:** [July 6, 2021, 6:22pm UTC](https://discourse.julialang.org/t/turing-model-that-records-objective-function-values/64167 "2021-07-06T18:22:17Z")

</div>

Hi, this might be a bit of a silly question but I’m using Turing to run a Bayesian MCMC algorithm. I’m using a distribution I made up as the distribution of my response variable and I would like the chain object to store…

---

## [HPV disease model estimation (beginner issue)](https://discourse.julialang.org/t/hpv-disease-model-estimation-beginner-issue/63981)

<div class="topic-metadata">

**Author:** [@Mevlut\_Cayli](https://discourse.julialang.org/u/Mevlut_Cayli)\
**Replies:** 2\
**Last updated:** [July 3, 2021, 8:41pm UTC](https://discourse.julialang.org/t/hpv-disease-model-estimation-beginner-issue/63981 "2021-07-03T20:41:21Z")

</div>

\`Hi, I 'm trying to estimate HPV model parameters with Turing but I’m not sure about how to determine prior parameters especially with σ , so when I run the model it seems because of the bad selection of σ last parameter…

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

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