# How to fit a Dirichlet Distribution using MLE in Distributions.jl?

**URL:** <https://discourse.julialang.org/t/how-to-fit-a-dirichlet-distribution-using-mle-in-distributions-jl/49645>\
**Category:** Statistics\
**Tags:** statistics, turing, distributions\
**Created:** [November 5, 2020, 9:30pm UTC](https://discourse.julialang.org/t/how-to-fit-a-dirichlet-distribution-using-mle-in-distributions-jl/49645 "2020-11-05T21:30:54Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![stochastic\_guy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stochastic_guy/32/9877_2.png) [@stochastic\_guy](https://discourse.julialang.org/u/stochastic_guy)\
**Post date:** [November 6, 2020, 4:40pm UTC](https://discourse.julialang.org/t/how-to-fit-a-dirichlet-distribution-using-mle-in-distributions-jl/49645/5 "2020-11-06T16:40:08Z")

</div>

Sorry I missed your response in slack. I just saw your reply.

- VectorOfArrays come from here:

> [@Very best way to concatenate an array of arrays](https://discourse.julialang.org/t/very-best-way-to-concatenate-an-array-of-arrays/8672/2):
>
> using RecursiveArrayTools VA = VectorOfArray(A) arr = convert(Array,VA) VectorOfArray is a lazy representation of the array of arrays as a higher order tensor (/matrix if A is a vector of vectors). It uses the indexing fallback to do the conversion. Honestly, I tried writing my own loop for the conversion but the fallback was faster (Tim Holy Cartesian magic?) so this is what I’ve found to be the fastest, and I don’t know how to recreate it without using the lazy matrix indexing.

- Alphas are the priors to the Dirichlet Distribution.
- K should take +ve integer value (User can decide what value to take)

---

_[View the full topic](https://discourse.julialang.org/t/how-to-fit-a-dirichlet-distribution-using-mle-in-distributions-jl/49645)._
