Half-Normal distribution
Story
The Half-Normal distribution is a Normal distribution truncated to only have nonzero probability density for values greater than or equal to the location of the peak.
Parameters
The Half-Normal distribution is parametrized by a positive scale parameter \(\sigma\) and a location parameter \(\mu\). In most applications, \(\mu = 0\).
Support
The Half-Normal distribution is supported on the set of all real numbers that are greater than or equal to \(\mu\), that is on \([\mu, \infty)\).
Probability density function
Note that the distribution is only supported for \(y \ge \mu\).
Cumulative distribution function
where \(\text{erf}(x)\) denotes the error function.
Moments
Mean: \(\displaystyle{\mu + \sqrt{\frac{2\sigma^2}{\pi}}}\)
Variance: \(\displaystyle{\left(1 - \frac{2}{\pi}\right)\sigma^2}\)
Usage
Package |
Syntax |
---|---|
NumPy |
|
SciPy |
|
Distributions.jl |
|
Stan sampling |
|
Stan rng |
|
Notes
In Stan, a Half-Normal is defined by putting a lower bound of \(\mu\) on the variable and then using a Normal distribution with location parameter \(\mu\).
The Half-Normal distribution with \(\mu = 0\) is a useful prior for nonnegative parameters that should not be too large and may be very close to zero.