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


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 σ?

1 Like

it seems normal to me (pun intended)


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



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. 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. For the same reason, the Cholesky factor of \Sigma is commonly used for the multivariate normal.


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.

1 Like

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 :

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).

1 Like

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