# Inverse of cdf

**URL:** <https://discourse.julialang.org/t/inverse-of-cdf/53397>\
**Category:** General Usage\
**Created:** [January 15, 2021, 6:01pm UTC](https://discourse.julialang.org/t/inverse-of-cdf/53397 "2021-01-15T18:01:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nh3436](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@nh3436](https://discourse.julialang.org/u/nh3436)\
**Post date:** [January 15, 2021, 6:01pm UTC](https://discourse.julialang.org/t/inverse-of-cdf/53397/1 "2021-01-15T18:01:33Z")

</div>

Hi all,

I am a beginner to Julia and I am trying to code inverse function of normal cdf. In Distribution.ji, I see there is invlogcdf, inverse function of log cdf of a distribution but not inverse function of cdf. Any suggestions will be a great help!

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [January 15, 2021, 6:03pm UTC](https://discourse.julialang.org/t/inverse-of-cdf/53397/2 "2021-01-15T18:03:50Z")

</div>

Inverse function of `cdf` is `quantile`  
IIRC

I think there is a debate somewhere about making `invcdf` an alias for `quantile`

---

<div class="post-metadata">

**Author:** ![nh3436](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@nh3436](https://discourse.julialang.org/u/nh3436)\
**Post date:** [January 15, 2021, 6:23pm UTC](https://discourse.julialang.org/t/inverse-of-cdf/53397/3 "2021-01-15T18:23:25Z")

</div>

Hi oxinabox,

You are correct, it was actually in Distribution.ji package. Thank you so much!

---

<div class="post-metadata">

**Author:** ![ignace](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ignace/32/24275_2.png) [@ignace](https://discourse.julialang.org/u/ignace)\
**Post date:** [August 5, 2021, 8:40am UTC](https://discourse.julialang.org/t/inverse-of-cdf/53397/4 "2021-08-05T08:40:45Z")

</div>

Does there exist a Julia function that can numerically compute the inverse CDF (aka quantile funtion) of an **ensemble of samples** (in contrast to a pre-defined distribution from `Distributions.jl`)? Or from a **histogram** of those samples?  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [August 5, 2021, 8:52am UTC](https://discourse.julialang.org/t/inverse-of-cdf/53397/5 "2021-08-05T08:52:56Z")

</div>

Isn’t that also `quantile`?

```julia
julia> using Statistics

julia> xs = [1,1,2,2,3,4,5,6,7,8];

julia> quantile(xs, 0.25)
2.0

julia> quantile(xs, 0.99)
7.91

julia> quantile(xs, 1)
8

```

---

<div class="post-metadata">

**Author:** ![ignace](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ignace/32/24275_2.png) [@ignace](https://discourse.julialang.org/u/ignace)\
**Post date:** [August 5, 2021, 9:12am UTC](https://discourse.julialang.org/t/inverse-of-cdf/53397/6 "2021-08-05T09:12:59Z")

</div>

You are right @oxinabox, thank you!

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [May 28, 2024, 1:52am UTC](https://discourse.julialang.org/t/inverse-of-cdf/53397/7 "2024-05-28T01:52:18Z")

</div>

A post was split to a new topic: [Approximating the inverse of an expensive CDF function](https://discourse.julialang.org/t/approximating-the-inverse-of-an-expensive-cdf-function/114809)
