# How does one use empirical distributions?

**URL:** <https://discourse.julialang.org/t/how-does-one-use-empirical-distributions/18360>\
**Category:** Statistics\
**Created:** [December 6, 2018, 4:29am UTC](https://discourse.julialang.org/t/how-does-one-use-empirical-distributions/18360 "2018-12-06T04:29:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [December 6, 2018, 4:29am UTC](https://discourse.julialang.org/t/how-does-one-use-empirical-distributions/18360/1 "2018-12-06T04:29:38Z")

</div>

dear stats experts—the following used to work.

```julia
julia> using Random, Distributions; Random.seed!(0);

julia> x= max.(randn(10000), (rand(10000) .- 0.5));

julia> empcdfun= EmpiricalUnivariateDistribution( x );

julia> cdf.( empcdfun, [-0.5,-0.25,0.0,0.5, 10.0] )
5-element Array{Float64,1}:
 0.0
 0.0998
 0.2453
 0.6972
 1.0

```

but no longer… ☹

```julia
ERROR: MethodError: Cannot `convert` an object of type StatsBase.ECDF{Array{Float64,1}} to an object of type Function
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:154

```

There is also no example in the ‘?EmpiricalUnivariateDistribution’ internal docs. Could someone please provide a short example?

regards,

/iaw

---

<div class="post-metadata">

**Author:** ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)\
**Post date:** [December 6, 2018, 4:41am UTC](https://discourse.julialang.org/t/how-does-one-use-empirical-distributions/18360/2 "2018-12-06T04:41:04Z")

</div>

The short answer is [you don’t](https://github.com/JuliaStats/Distributions.jl/pull/800).
