# The reason why the parameters for Distributions.Normal is mean and standard deviation

**URL:** <https://discourse.julialang.org/t/the-reason-why-the-parameters-for-distributions-normal-is-mean-and-standard-deviation/22088>\
**Category:** Internals & Design\
**Tags:** question, package\
**Created:** [March 20, 2019, 3:21am UTC](https://discourse.julialang.org/t/the-reason-why-the-parameters-for-distributions-normal-is-mean-and-standard-deviation/22088 "2019-03-20T03:21:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![paalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paalon/32/5784_2.png) [@paalon](https://discourse.julialang.org/u/paalon)\
**Post date:** [March 20, 2019, 3:21am UTC](https://discourse.julialang.org/t/the-reason-why-the-parameters-for-distributions-normal-is-mean-and-standard-deviation/22088/1 "2019-03-20T03:21:29Z")

</div>

I have fallen into a stagnation of my work due to the normal distribution of the package `Distributions` need to be specified its _mean_ and _standard deviation_ but I have assumed that _mean_ and _variance_ because most of the mathematical expression for normal distribution is like N(μ, σ²) as far as I have experienced. This is my fault since I hadn’t checked it carefully, but are there any reason that the default parameter for normal dist. is σ?

---

<div class="post-metadata">

**Author:** ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Post date:** [March 20, 2019, 5:42am UTC](https://discourse.julialang.org/t/the-reason-why-the-parameters-for-distributions-normal-is-mean-and-standard-deviation/22088/2 "2019-03-20T05:42:25Z")

</div>

it seems normal to me (pun intended)

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [March 20, 2019, 7:04am UTC](https://discourse.julialang.org/t/the-reason-why-the-parameters-for-distributions-normal-is-mean-and-standard-deviation/22088/3 "2019-03-20T07:04:44Z")

</div>

Julia is not an outlier in this.  
For example Maple, R, MATLAB and NIST use standard deviation

R’s [R: The Normal Distribution](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Normal.html)  
MATLAB’s [Normal Distribution - MATLAB & Simulink](https://www.mathworks.com/help/stats/normal-distribution.html)  
NIST’s [1.3.6.6.1. Normal Distribution](https://www.itl.nist.gov/div898/handbook/eda/section3/eda3661.htm)

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 20, 2019, 8:50am UTC](https://discourse.julialang.org/t/the-reason-why-the-parameters-for-distributions-normal-is-mean-and-standard-deviation/22088/4 "2019-03-20T08:50:22Z")

</div>

> [@paalon](#):
>
> I have fallen into a stagnation of my work due to the normal distribution

I wonder if you are exaggerating here; this should be a simple problem to deal with.

In any case, some distributions have different parametrizations, depending on the field, whether it is a theory text or a programming API. Eg \Gamma has [three widely used ones](https://en.wikipedia.org/wiki/Gamma_distribution). This is something you need to learn to deal with, by reading the docs of the tools you are using.

But specifically, \sigma is very useful since it is usable directly in [the density](https://en.wikipedia.org/wiki/Normal_distribution#General_normal_distribution). For the same reason, the Cholesky factor of \Sigma is commonly used for the multivariate normal.

---

<div class="post-metadata">

**Author:** ![yha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yha/32/3502_2.png) [@yha](https://discourse.julialang.org/u/yha)\
**Post date:** [March 20, 2019, 10:52am UTC](https://discourse.julialang.org/t/the-reason-why-the-parameters-for-distributions-normal-is-mean-and-standard-deviation/22088/5 "2019-03-20T10:52:30Z")

</div>

I believe the usual convention for univariate distributions in numerical packages is using location and scale parameters when possible/reasonable, even when it’s not the standard mathematical notation. For example, `Distributions.Exponential` is parameterized by scale rather than rate.  
This does create an unfortunate inconsistency with the multivariate normal (which is parameterized by the variance \Sigma), but it’s at least the same inconsistency as in MATLAB and numpy, and probably others.

---

<div class="post-metadata">

**Author:** ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)\
**Post date:** [March 20, 2019, 2:47pm UTC](https://discourse.julialang.org/t/the-reason-why-the-parameters-for-distributions-normal-is-mean-and-standard-deviation/22088/6 "2019-03-20T14:47:27Z")

</div>

Given that different people may find different parametrizations more intuitive (for example for some reason shape and rate is much more intuitive to me than shape and scale for Gamma) this is probably a good motivation for adding keyword constructors :

[https://github.com/JuliaStats/Distributions.jl/pull/823](https://github.com/JuliaStats/Distributions.jl/pull/823)

I imagine one could propose that the keyword constructor behaves a bit like `range(a, b; step, length)` (in that providing one between step and length is mandatory) and just makes sure that it has a set of parameters that uniquely determine the distribution, so `Gamma(shape = 10, scale = 2)` would be the same as `Gamma(shape = 10, rate = 0.5)`.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 20, 2019, 2:48pm UTC](https://discourse.julialang.org/t/the-reason-why-the-parameters-for-distributions-normal-is-mean-and-standard-deviation/22088/7 "2019-03-20T14:48:50Z")

</div>

That may be the best solution, especially now that keywords are costless (AFAIK).
