# How to create sum-log-likelihood of custom distribution for use in Turing.jl

**URL:** <https://discourse.julialang.org/t/how-to-create-sum-log-likelihood-of-custom-distribution-for-use-in-turing-jl/107011>\
**Category:** Probabilistic Programming\
**Tags:** turing, distributions\
**Created:** [December 1, 2023, 6:40pm UTC](https://discourse.julialang.org/t/how-to-create-sum-log-likelihood-of-custom-distribution-for-use-in-turing-jl/107011 "2023-12-01T18:40:44Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)\
**Post date:** [December 5, 2023, 7:31pm UTC](https://discourse.julialang.org/t/how-to-create-sum-log-likelihood-of-custom-distribution-for-use-in-turing-jl/107011/2 "2023-12-05T19:31:30Z")

</div>

I think what you need is to define a multivariate distribution and then a custom `logpdf` for the whole vector.

This might be relevant:

> [@Custom multivariate distribution in Turing.jl](https://discourse.julialang.org/t/custom-multivariate-distribution-in-turing-jl/88414):
>
> I want to use a custom multivariate distribution that actually generates arrays, and I want to know if there’s anything I need to modify in order to be adapted to be used in Turing using Distributions struct OrthoNNDist \<: DiscreteMultivariateDistribution x0::Vector{Float64} oc::Array{Float64,2} x1s::Array prob::Float64 #return a new uniform distribution with all vectors in x1s orthogonal to oc function OrthoNNDist(x0::Vector{Float64}, oc::Array{Float64,2}) x1s = [] for i = 1:size(…

---

_[View the full topic](https://discourse.julialang.org/t/how-to-create-sum-log-likelihood-of-custom-distribution-for-use-in-turing-jl/107011)._
