# Matlab mle function in Julia

**URL:** <https://discourse.julialang.org/t/matlab-mle-function-in-julia/16593>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [October 21, 2018, 6:01am UTC](https://discourse.julialang.org/t/matlab-mle-function-in-julia/16593 "2018-10-21T06:01:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yifan\_Liu](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Post date:** [October 21, 2018, 6:01am UTC](https://discourse.julialang.org/t/matlab-mle-function-in-julia/16593/1 "2018-10-21T06:01:00Z")

</div>

I was wondering if Julia has a Maximum likelihood estimates function like the mle in Matlab.

> **[Maximum likelihood estimates - MATLAB mle](https://www.mathworks.com/help/stats/mle.html)**
>
> This MATLAB function returns maximum likelihood estimates (MLEs) for the parameters of a normal distribution, using the sample data data.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 21, 2018, 6:33am UTC](https://discourse.julialang.org/t/matlab-mle-function-in-julia/16593/2 "2018-10-21T06:33:57Z")

</div>

[https://juliastats.github.io/Distributions.jl/latest/fit.html](https://juliastats.github.io/Distributions.jl/latest/fit.html)

---

<div class="post-metadata">

**Author:** ![Yifan\_Liu](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Post date:** [October 21, 2018, 3:06pm UTC](https://discourse.julialang.org/t/matlab-mle-function-in-julia/16593/3 "2018-10-21T15:06:51Z")

</div>

This function seems to not accept customized PDF, also the package is not 1.0 compatible

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 21, 2018, 3:17pm UTC](https://discourse.julialang.org/t/matlab-mle-function-in-julia/16593/4 "2018-10-21T15:17:42Z")

</div>

I’m pretty sure it’s ready for Julia v1.0.  
If you want to do arbitrary ML estimation you would have to use an optimizer like Optim.jl

---

<div class="post-metadata">

**Author:** ![mcreel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcreel/32/30088_2.png) [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Post date:** [October 21, 2018, 4:49pm UTC](https://discourse.julialang.org/t/matlab-mle-function-in-julia/16593/5 "2018-10-21T16:49:18Z")

</div>

This will allow you to do ML estimation for a user-supplied likelihood function: [https://github.com/mcreel/Econometrics.jl/blob/master/src/ML/mleresults.jl](https://github.com/mcreel/Econometrics.jl/blob/master/src/ML/mleresults.jl)

```julia
julia> mleresults()
execute edit(mleresults,()) to examine the example code
true betas: 
     0.60021
     0.02946
     0.24307
************************************************************
simple ML example
MLE Estimation Results Convergence: true
Average Log-L: -1.29631 Observations: 100
Sandwich form covariance estimator

                estimate st. err t-stat p-value
           1 0.45890 0.09305 4.93168 0.00000
           2 0.08012 0.10026 0.79914 0.42616
           3 0.16250 0.10436 1.55706 0.12271

Information Criteria
                   Crit. Crit/n
       CAIC 276.07838 2.76078
        BIC 273.07838 2.73078
        AIC 265.26287 2.65263
************************************************************

julia> 

```
