# Recover MLE fit parameters in vector form

**URL:** <https://discourse.julialang.org/t/recover-mle-fit-parameters-in-vector-form/47972>\
**Category:** Statistics\
**Tags:** fit, mle\
**Created:** [October 8, 2020, 6:46am UTC](https://discourse.julialang.org/t/recover-mle-fit-parameters-in-vector-form/47972 "2020-10-08T06:46:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Albert\_Zevelev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albert_zevelev/32/11844_2.png) [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Post date:** [October 8, 2020, 6:46am UTC](https://discourse.julialang.org/t/recover-mle-fit-parameters-in-vector-form/47972/1 "2020-10-08T06:46:22Z")

</div>

Suppose I fit some data

```julia
using Distributions, Random;
DGP_True = LogNormal(0,1);
Random.seed!(123);
const d_train = rand(DGP_True, 1_000);
D1=Distributions.fit_mle(LogNormal, d_train)

#Gives a fit distribution
julia> D1
LogNormal{Float64}(μ=0.03421345999528483, σ=0.9966633047846717)

```

Question: how can I recover the fit parameters from `D1` in vector form?  
ie: [μ=0.03421345999528483, σ=0.9966633047846717]  
or: ie: [0.03421345999528483, 0.9966633047846717]

---

<div class="post-metadata">

**Author:** ![aachener](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aachener/32/18112_2.png) [@aachener](https://discourse.julialang.org/u/aachener)\
**Post date:** [October 8, 2020, 6:50am UTC](https://discourse.julialang.org/t/recover-mle-fit-parameters-in-vector-form/47972/2 "2020-10-08T06:50:46Z")

</div>

try this

```julia
julia> temp = [D1.μ, D1.σ]

```

> [@Albert\_Zevelev](#):
>
> ```julia
> using Distributions, Random;
> DGP_True = LogNormal(0,1);
> Random.seed!(123);
> const d_train = rand(DGP_True, 1_000);
> D1=Distributions.fit_mle(LogNormal, d_train)
> 
> ```

---

<div class="post-metadata">

**Author:** ![Albert\_Zevelev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albert_zevelev/32/11844_2.png) [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Post date:** [October 8, 2020, 6:52am UTC](https://discourse.julialang.org/t/recover-mle-fit-parameters-in-vector-form/47972/3 "2020-10-08T06:52:59Z")

</div>

Thanks but I’m looping over 52 distributions. Some have 1 parameters, others 2, 3, 4.  
I want some function where f(D1) automatically gives me the fit params.  
So: f(D1)=[μ=0.03421345999528483, σ=0.9966633047846717]  
Or: f(D1)= [0.03421345999528483, 0.9966633047846717]

---

<div class="post-metadata">

**Author:** ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)\
**Post date:** [October 8, 2020, 10:40am UTC](https://discourse.julialang.org/t/recover-mle-fit-parameters-in-vector-form/47972/4 "2020-10-08T10:40:48Z")

</div>

> [@Albert\_Zevelev](#):
>
> ```julia
> using Distributions, Random;
> DGP_True = LogNormal(0,1);
> Random.seed!(123);
> const d_train = rand(DGP_True, 1_000);
> D1=Distributions.fit_mle(LogNormal, d_train)
> 
> ```

Does `params(D1)` work for you?

---

<div class="post-metadata">

**Author:** ![Albert\_Zevelev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albert_zevelev/32/11844_2.png) [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Post date:** [October 8, 2020, 2:53pm UTC](https://discourse.julialang.org/t/recover-mle-fit-parameters-in-vector-form/47972/5 "2020-10-08T14:53:38Z")

</div>

Thank you! I totally forgot `params(d)` works on fitted distributions.
