JuliaStats / Distributions.jl

A Julia package for probability distributions and associated functions.
Other
1.1k stars 414 forks source link

Add alias `invcdf` for `quantile` #707

Open dpsanders opened 6 years ago

dpsanders commented 6 years ago

Compare https://github.com/JuliaStats/Distributions.jl/issues/489

dpsanders commented 6 years ago

invcdf is more intuitive / discoverable (from a discussion on Slack)

andreasnoack commented 6 years ago

invcdf is more intuitive / discoverable

It depends on your training. I think most people with a stats background will look for the quantile function.

dpsanders commented 6 years ago

OK, but I had no idea to look for the quantile function...

ararslan commented 6 years ago

FWIW I've never heard of invcdf until now and wouldn't think it use it when I'm looking for quantiles.

dpsanders commented 6 years ago

It's the inverse function of the CDF.

https://en.wikipedia.org/wiki/Cumulative_distribution_function#Inverse_distribution_function_(quantile_function)

ararslan commented 6 years ago

Right, I get from the name what it is, I've just never seen that terminology used in this context.

dmbates commented 6 years ago

@ararslan The names invcdf, invccdf, invlogcdf and invlogccdf are used throughout the https://github.com/JuliaStats/StatsFuns.jl sources in preference to quantile and variations. For one thing it is easier to compound "inverse", "complementary" and "log" to create a meaningful name. "Complementary quantile" doesn't parse the same as "inverse complementary cdf".

Nosferican commented 6 years ago

I believe the invcdf is used in part within the GLM framework (link functions, canonical links) and less so in more general statistics which use quantile. I think is fine to have it aliased and used for the code as @dmbates mentioned, but use quantile as the default for the API.

freeboson commented 6 years ago

I don't see the harm in offering the alias, since at least some people are familiar with the term (including me). The docstring would still call it quantile.

baggepinnen commented 5 years ago

I was just going to open a similar issue, I was looking for the inverse of the cdf and wrote code along the lines of

invfun(::Normal) = StatsFuns.norminvcdf
invfun(::Gamma) = StatsFuns.gammainvcdf
invfun(::Poisson) = StatsFuns.poisinvcdf
invfun(::TDist) = StatsFuns.tdistinvcdf
invfun(::Beta) = StatsFuns.betainvcdf
invfun(x) = nothing

before I figured out it was called quantile :P

OvidiusCicero commented 5 years ago

I know I'm late for this issue but I'm also more used to invcdf (Mathematica calls it so) than quantile. What does actually go against having an alias?

StevenSiew commented 4 years ago

If you don't add it to the code. Could you at least add it to the documentation? A reminder to the reader that invcdf function is the same as quantile function