# \#distributions

**URL:** https://discourse.julialang.org/tag/distributions/387.md

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

---

## [Automatic reparametrizations of distributions in Distributions.jl](https://discourse.julialang.org/t/automatic-reparametrizations-of-distributions-in-distributions-jl/132431)

<div class="topic-metadata">

**Author:** [@giovannitinervia9](https://discourse.julialang.org/u/giovannitinervia9)\
**Replies:** 2\
**Last updated:** [August 6, 2026, 9:53am UTC](https://discourse.julialang.org/t/automatic-reparametrizations-of-distributions-in-distributions-jl/132431 "2026-08-06T09:53:24Z")

</div>

Hi everyone, I’m thinking about a potential feature for the Distributions.jl package that would be nice to have. Would it be possible to implement a function, let’s say reparametrize, that takes an existing distribution…

---

## [Creating a new distibution with Distributions.jl](https://discourse.julialang.org/t/creating-a-new-distibution-with-distributions-jl/138436)

<div class="topic-metadata">

**Author:** [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Replies:** 5\
**Last updated:** [July 24, 2026, 8:01pm UTC](https://discourse.julialang.org/t/creating-a-new-distibution-with-distributions-jl/138436 "2026-07-24T20:01:05Z")

</div>

Hello I am trying to create a new discrete distribution using the package Distributions.jl but I am getting error. I have tried with import instead of using but I always get the same message. using Distributions julia\> …

---

## [\[ANN\] AdditionalDistributions.jl v0.2.1 — Multivariate Gaussian and Student-t CDFs, benchmarks, and ecosystem examples](https://discourse.julialang.org/t/ann-additionaldistributions-jl-v0-2-1-multivariate-gaussian-and-student-t-cdfs-benchmarks-and-ecosystem-examples/137895)

<div class="topic-metadata">

**Author:** [@Santymax98](https://discourse.julialang.org/u/Santymax98)\
**Replies:** 0\
**Last updated:** [July 1, 2026, 3:57pm UTC](https://discourse.julialang.org/t/ann-additionaldistributions-jl-v0-2-1-multivariate-gaussian-and-student-t-cdfs-benchmarks-and-ecosystem-examples/137895 "2026-07-01T15:57:31Z")

</div>

Hi everyone, I’m happy to announce AdditionalDistributions.jl v0.2.1. AdditionalDistributions.jl extends the Distributions.jl ecosystem with additional univariate and multivariate probability distributions. This annou…

---

## [New to Julia - questions about optimizing my Turing code](https://discourse.julialang.org/t/new-to-julia-questions-about-optimizing-my-turing-code/137008)

<div class="topic-metadata">

**Author:** [@petalmokryn](https://discourse.julialang.org/u/petalmokryn)\
**Replies:** 8\
**Last updated:** [May 9, 2026, 8:53pm UTC](https://discourse.julialang.org/t/new-to-julia-questions-about-optimizing-my-turing-code/137008 "2026-05-09T20:53:58Z")

</div>

Hi everyone, nice to meet you I’m trying to write a custom multivariate model in Julia using banded matrix operations, starting with the simple example of a Gaussian random walk with IID innovations and IID observation …

---

## [Why do the density plots with Unitful display units on the "wrong" axis?](https://discourse.julialang.org/t/why-do-the-density-plots-with-unitful-display-units-on-the-wrong-axis/135727)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 0\
**Last updated:** [February 19, 2026, 1:38pm UTC](https://discourse.julialang.org/t/why-do-the-density-plots-with-unitful-display-units-on-the-wrong-axis/135727 "2026-02-19T13:38:56Z")

</div>

Hi all! I noticed that, when plotting the probability distribution of some data with Plots.jl with density(x), the axis representing the “underlying” data, is on the x axis: using Plots using StatsPlots x = \[1,1,1,2,2\] …

---

## [Overdispersed alternative to multinomial](https://discourse.julialang.org/t/overdispersed-alternative-to-multinomial/134533)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [December 20, 2025, 3:27pm UTC](https://discourse.julialang.org/t/overdispersed-alternative-to-multinomial/134533 "2025-12-20T15:27:25Z")

</div>

I have a multilevel Bayesian model where (a\_i, b\_i, c\_i) = f(\\theta\_i) for each unit i = 1, \\dots, 1000, which are latent variables, f comes from a model. For each i, and j = 1, 2, 3, I observe (A\_{i,j}, B\_{i,j}, C\_{i,j…

---

## [Issue with Binomial distribution and recent ForwardDiff versions](https://discourse.julialang.org/t/issue-with-binomial-distribution-and-recent-forwarddiff-versions/134347)

<div class="topic-metadata">

**Author:** [@Pablo\_Marchant](https://discourse.julialang.org/u/Pablo_Marchant)\
**Replies:** 2\
**Last updated:** [December 12, 2025, 3:57pm UTC](https://discourse.julialang.org/t/issue-with-binomial-distribution-and-recent-forwarddiff-versions/134347 "2025-12-12T15:57:48Z")

</div>

Hi, recently I noticed some code I’ve been using broke after updating Forward Diff. The issue came from sampling with Turing using a binomial likelihood. Digging into it it boiled down to this: using ForwardDiff using …

---

## [Kolmogorov-Smirnov test](https://discourse.julialang.org/t/kolmogorov-smirnov-test/89990)

<div class="topic-metadata">

**Author:** [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Replies:** 23\
**Last updated:** [October 22, 2025, 6:46pm UTC](https://discourse.julialang.org/t/kolmogorov-smirnov-test/89990 "2025-10-22T18:46:20Z")

</div>

I have a sample consisting of a set of integers and want to test if can be from a specific distribution. I am not that strong in statistics, but my understanding is that the Kolmogorov-Smirnov test is a good choice for a…

---

## [\[Pre-ANN\] ARS.jl](https://discourse.julialang.org/t/pre-ann-ars-jl/131766)

<div class="topic-metadata">

**Author:** [@Eliassj](https://discourse.julialang.org/u/Eliassj)\
**Replies:** 4\
**Last updated:** [August 22, 2025, 10:31am UTC](https://discourse.julialang.org/t/pre-ann-ars-jl/131766 "2025-08-22T10:31:08Z")

</div>

Repo: GitHub - Eliassj/ARS.jl Docs: eliassj.github.io/ARS.jl/dev/ While working on another project I found that AdaptiveRejectionSampling.jl, while very good in other ways, did not allow for other numeric types than Fl…

---

## [Obtain the prior distribution for a function's parameter](https://discourse.julialang.org/t/obtain-the-prior-distribution-for-a-functions-parameter/131677)

<div class="topic-metadata">

**Author:** [@Cyan](https://discourse.julialang.org/u/Cyan)\
**Replies:** 3\
**Last updated:** [August 18, 2025, 5:50pm UTC](https://discourse.julialang.org/t/obtain-the-prior-distribution-for-a-functions-parameter/131677 "2025-08-18T17:50:23Z")

</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 b ~ truncated(Normal(1., 1), 0, 5) s ~ t…

---

## [Generalized Chi-squared distribution](https://discourse.julialang.org/t/generalized-chi-squared-distribution/106055)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 5\
**Last updated:** [July 26, 2025, 7:37am UTC](https://discourse.julialang.org/t/generalized-chi-squared-distribution/106055 "2025-07-26T07:37:25Z")

</div>

Does anybody know some attempt to implement the Generalized Chi-squared distribution in Julia? (First I looked for it in Distributions.jl, but I have not found it there or anywhere else.)

---

## [Set distribution for function parameters](https://discourse.julialang.org/t/set-distribution-for-function-parameters/130963)

<div class="topic-metadata">

**Author:** [@Cyan](https://discourse.julialang.org/u/Cyan)\
**Replies:** 2\
**Last updated:** [July 23, 2025, 2:18pm UTC](https://discourse.julialang.org/t/set-distribution-for-function-parameters/130963 "2025-07-23T14:18:24Z")

</div>

Hi, all. I am stucked by the problems of building a @model for a parameters of a function when using Turing. Such as for function f(x; b, c), I want to obtain a model like @model fuction(x,y) b ~ truncated(Normal(1., 1)…

---

## [Fitting a distribution not supported by Distributions.jl](https://discourse.julialang.org/t/fitting-a-distribution-not-supported-by-distributions-jl/130818)

<div class="topic-metadata">

**Author:** [@henry2004y](https://discourse.julialang.org/u/henry2004y)\
**Replies:** 6\
**Last updated:** [July 18, 2025, 1:14am UTC](https://discourse.julialang.org/t/fitting-a-distribution-not-supported-by-distributions-jl/130818 "2025-07-18T01:14:42Z")

</div>

Hi, I want to fit an analytical distribution in Julia from discrete points. For instance, this specific Levy distribution is listed in Distributions.jl, but the fit method is not supported for this type: Distribution Fi…

---

## [Draw a random number through a probability distribution defined as an array](https://discourse.julialang.org/t/draw-a-random-number-through-a-probability-distribution-defined-as-an-array/129210)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 5\
**Last updated:** [May 21, 2025, 10:40am UTC](https://discourse.julialang.org/t/draw-a-random-number-through-a-probability-distribution-defined-as-an-array/129210 "2025-05-21T10:40:30Z")

</div>

If I have an NxM matrix with decimal values (normalised so that the sum is 1): prob\_dens::Matrix{Float64.Float64} is there a good way to randomly draw an index i,j with probability corresponding to the probability dist…

---

## [Fastest way to sample from MVN, changing parameters](https://discourse.julialang.org/t/fastest-way-to-sample-from-mvn-changing-parameters/128145)

<div class="topic-metadata">

**Author:** [@Daniel\_Johansson](https://discourse.julialang.org/u/Daniel_Johansson)\
**Replies:** 7\
**Last updated:** [May 3, 2025, 4:11pm UTC](https://discourse.julialang.org/t/fastest-way-to-sample-from-mvn-changing-parameters/128145 "2025-05-03T16:11:23Z")

</div>

Hey guys! Does anybody know what is the most efficient way of sampling from a multivariate normal distribution whose parameters are constantly updated. I’m constructing a Gibbs sampler for a MVN whose parameters depend …

---

## [Anything like Distributions.jl but works on GPU in 2025?](https://discourse.julialang.org/t/anything-like-distributions-jl-but-works-on-gpu-in-2025/127783)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 0\
**Last updated:** [April 7, 2025, 4:46am UTC](https://discourse.julialang.org/t/anything-like-distributions-jl-but-works-on-gpu-in-2025/127783 "2025-04-07T04:46:24Z")

</div>

Anything like Distributions.jl for GPU? was the previous discussion. I guess the answer is still no: CUDA support ? · Issue #1183 · JuliaStats/Distributions.jl · GitHub Calculating Distributions PDF in the GPU · Issue…

---

## [Why \`sprand\` does not accept a Distribution arg?](https://discourse.julialang.org/t/why-sprand-does-not-accept-a-distribution-arg/127255)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 10\
**Last updated:** [April 3, 2025, 4:02am UTC](https://discourse.julialang.org/t/why-sprand-does-not-accept-a-distribution-arg/127255 "2025-04-03T04:02:18Z")

</div>

Hi there, I wonder why this cannot work out (What is the available method currently then?). julia\> import SparseArrays.sprand as sprand julia\> import Distributions.Uniform as UD julia\> sprand(5, 6, .7) 5×6 SparseArra…

---

## [How to sample many ordered iid variables in turing](https://discourse.julialang.org/t/how-to-sample-many-ordered-iid-variables-in-turing/127205)

<div class="topic-metadata">

**Author:** [@swsw](https://discourse.julialang.org/u/swsw)\
**Replies:** 2\
**Last updated:** [March 24, 2025, 2:34pm UTC](https://discourse.julialang.org/t/how-to-sample-many-ordered-iid-variables-in-turing/127205 "2025-03-24T14:34:56Z")

</div>

Hi there, I’d like to sample many ordered iid varialbles but i find when the number of samples is large the efficiency gets very low. For the subsequent code it works when the number of variables is 30 or so but not whe…

---

## [Product distribution allocates (a lot)](https://discourse.julialang.org/t/product-distribution-allocates-a-lot/126771)

<div class="topic-metadata">

**Author:** [@JADekker](https://discourse.julialang.org/u/JADekker)\
**Replies:** 9\
**Last updated:** [March 11, 2025, 3:12pm UTC](https://discourse.julialang.org/t/product-distribution-allocates-a-lot/126771 "2025-03-11T15:12:17Z")

</div>

Hi, I just found out that in the following example, sampling from a Distributions.Product distribution is much slower and allocates much more than implementing the sampler manually. Is there something that I’m overlookin…

---

## [Can Turing differentiate a truncated Poisson](https://discourse.julialang.org/t/can-turing-differentiate-a-truncated-poisson/126082)

<div class="topic-metadata">

**Author:** [@Domenic\_Di\_Francesco](https://discourse.julialang.org/u/Domenic_Di_Francesco)\
**Replies:** 1\
**Last updated:** [February 19, 2025, 5:49pm UTC](https://discourse.julialang.org/t/can-turing-differentiate-a-truncated-poisson/126082 "2025-02-19T17:49:55Z")

</div>

does Turing’s AD backend struggle with truncated Poisson distributions? Turing.@model function bps\_hurdle\_model(bonus::Vector{Int}, bps::Vector{Int}, μ\_αbps = 0, σ\_αbps = 1, μ\_βbps = 0, σ\_βbps = 1) α\_pzero ~ N…

---

## [Package for Non-Parametric Multivariate Discrete Distributions](https://discourse.julialang.org/t/package-for-non-parametric-multivariate-discrete-distributions/125046)

<div class="topic-metadata">

**Author:** [@bmit](https://discourse.julialang.org/u/bmit)\
**Replies:** 3\
**Last updated:** [January 27, 2025, 6:48am UTC](https://discourse.julialang.org/t/package-for-non-parametric-multivariate-discrete-distributions/125046 "2025-01-27T06:48:29Z")

</div>

I’m looking for a package that implements tools for working with non-parametric multivariate discrete distributions. Ideally, this would look something like a Multivariate version of DiscreteNonParametric in Distribution…

---

## [Fitting a truncated distribution](https://discourse.julialang.org/t/fitting-a-truncated-distribution/125067)

<div class="topic-metadata">

**Author:** [@johannesnauta](https://discourse.julialang.org/u/johannesnauta)\
**Replies:** 0\
**Last updated:** [January 22, 2025, 10:33am UTC](https://discourse.julialang.org/t/fitting-a-truncated-distribution/125067 "2025-01-22T10:33:22Z")

</div>

In Distributions.jl, is there no build-in functionality to fit truncated distributions? Of course I can write a small routine to do this, but either I cannot find documentation on it, or it is perhaps not implemented? If…

---

## [Package for Mixed Discrete Continuous Joint Distributions](https://discourse.julialang.org/t/package-for-mixed-discrete-continuous-joint-distributions/125048)

<div class="topic-metadata">

**Author:** [@bmit](https://discourse.julialang.org/u/bmit)\
**Replies:** 0\
**Last updated:** [January 21, 2025, 9:47pm UTC](https://discourse.julialang.org/t/package-for-mixed-discrete-continuous-joint-distributions/125048 "2025-01-21T21:47:01Z")

</div>

I’m looking for a package that implements tools for working with mixed multivariate discrete continuous joint distributions. A simple wikipedia definition of this can be found at https://en.wikipedia.org/wiki/Joint\_proba…

---

## [How to Use a Distribution Estimated via Kernel Density Estimation (KDE) as a Prior in Turing.jl](https://discourse.julialang.org/t/how-to-use-a-distribution-estimated-via-kernel-density-estimation-kde-as-a-prior-in-turing-jl/124504)

<div class="topic-metadata">

**Author:** [@hinata235](https://discourse.julialang.org/u/hinata235)\
**Replies:** 4\
**Last updated:** [January 12, 2025, 2:02pm UTC](https://discourse.julialang.org/t/how-to-use-a-distribution-estimated-via-kernel-density-estimation-kde-as-a-prior-in-turing-jl/124504 "2025-01-12T14:02:49Z")

</div>

Background and Goal I have a set of discrete samples (e.g., from some existing dataset or posterior). I estimated a continuous distribution from these samples using a kernel density estimation (KDE) approach (such as vi…

---

## [Product of probability distribution and nonrandom function](https://discourse.julialang.org/t/product-of-probability-distribution-and-nonrandom-function/124622)

<div class="topic-metadata">

**Author:** [@rand5](https://discourse.julialang.org/u/rand5)\
**Replies:** 0\
**Last updated:** [January 10, 2025, 4:49am UTC](https://discourse.julialang.org/t/product-of-probability-distribution-and-nonrandom-function/124622 "2025-01-10T04:49:40Z")

</div>

I have a probability distribution, e.g. Y = Normal() and would like to scale the distribution (updating its pdf, cdf, etc.) by a nonrandom function, say f(x) = cdf(Normal(1,2),x). Is there a way to do this and have the …

---

## [Sample StaticVectors with Distributions.jl](https://discourse.julialang.org/t/sample-staticvectors-with-distributions-jl/123792)

<div class="topic-metadata">

**Author:** [@Joaquin\_Rodriguez](https://discourse.julialang.org/u/Joaquin_Rodriguez)\
**Replies:** 2\
**Last updated:** [December 13, 2024, 10:03pm UTC](https://discourse.julialang.org/t/sample-staticvectors-with-distributions-jl/123792 "2024-12-13T22:03:04Z")

</div>

I need to generate some random vectors with a custom distribution, and I would like to use the Distributions.jl API. However, my vectors are small StaticVectors and sampling from a distribution returns plain Vectors. As…

---

## [Turing - "Automatic" Non-Centered Distribution Types](https://discourse.julialang.org/t/turing-automatic-non-centered-distribution-types/122598)

<div class="topic-metadata">

**Author:** [@farr](https://discourse.julialang.org/u/farr)\
**Replies:** 0\
**Last updated:** [November 13, 2024, 3:52pm UTC](https://discourse.julialang.org/t/turing-automatic-non-centered-distribution-types/122598 "2024-11-13T15:52:28Z")

</div>

Hi Folks, I experimented a bit today with some “automatic” non-centered Normal distributions this morning, and I think I have something that works quite well. Many experts know about the trick to replace mu ~ \<mu prio…

---

## [Sampling from custom distribution: "No method matching iterate..."](https://discourse.julialang.org/t/sampling-from-custom-distribution-no-method-matching-iterate/121925)

<div class="topic-metadata">

**Author:** [@alexdmeyer](https://discourse.julialang.org/u/alexdmeyer)\
**Replies:** 5\
**Last updated:** [October 29, 2024, 10:24pm UTC](https://discourse.julialang.org/t/sampling-from-custom-distribution-no-method-matching-iterate/121925 "2024-10-29T22:24:10Z")

</div>

Hello fellow Julians, I’m trying to use a custom distribution/sampleable for inference in Turing.jl, and I’ve encountered a problem I can’t solve. Following the instructions on the Turing docs, I made the following mini…

---

## [Why VonMisesFisher doesn't work for k = 0?](https://discourse.julialang.org/t/why-vonmisesfisher-doesnt-work-for-k-0/121595)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 1\
**Last updated:** [October 22, 2024, 7:02pm UTC](https://discourse.julialang.org/t/why-vonmisesfisher-doesnt-work-for-k-0/121595 "2024-10-22T19:02:47Z")

</div>

Hello everyone, I was planning to use VonMisesFisher distribution for some modelling purpose like random walk. But when I tried to sample vectors for k=0 which should be giving values following uniform distribution, fun…

---

## [Multivariate Student's T distribution?](https://discourse.julialang.org/t/multivariate-students-t-distribution/119676)

<div class="topic-metadata">

**Author:** [@rsenne](https://discourse.julialang.org/u/rsenne)\
**Replies:** 5\
**Last updated:** [September 23, 2024, 4:05pm UTC](https://discourse.julialang.org/t/multivariate-students-t-distribution/119676 "2024-09-23T16:05:47Z")

</div>

Does there exist any active implementations of a multivariate Student’s T distribution? I need one for a model I am implementing but the only information I could find was from a multi year old issue on the Distributions.…

[Next page](https://discourse.julialang.org/tag/distributions/387.md?match_all_tags=true&page=1&tags%5B%5D=distributions)
