Continuous distribution

Half-normal distribution

The absolute value of a normal quantity centred at zero: the size of a measurement error when only its magnitude matters, the distance a part ends up from its target in one dimension, a scale parameter that must be positive. In Bayesian models a half-normal is a common weakly informative prior on a standard deviation.

Half-normal probability calculator

P(X ≤ 0.67) = 0.497142

At the parameters set by the sliders. The shaded region on the plot is the probability; the dots on the CDF mark F at its ends.

PDF

00.250.50.750123456f(x)mean

CDF

00.250.50.7510123456F(x)

mean 0.7979 · variance 0.3634 · sd 0.6028 · mode 0 · entropy 0.7258 nats

Formulas

Parameters
  • , the standard deviation of the normal before folding
Support
PDF
CDF
Mean
Variance
Mode
MGF
Entropy

Here is the scale of the normal that was folded, not the standard deviation of (which is ). SciPy's halfnorm takes it as scale.

Worked example

A scale's errors are normal with mean 0 and standard deviation 2 g. What is the mean size of an error, ignoring its sign?

is Half-normal(), so the mean absolute error is g, about 80% of the standard deviation. answer checked by code

How it relates to others

All the relationships, as a diagram →

In Python

from scipy import stats
import numpy as np

X = stats.halfnorm(scale=1)
X.pdf(0.8)  # f(0.8) = 0.5794
X.cdf(0.8)  # P(X ≤ 0.8) = 0.5763
X.mean(), X.var()  # 0.7979, 0.3634
X.ppf(0.95)  # 95th percentile
X.rvs(size=10, random_state=0)

rng = np.random.default_rng(0)
np.abs(rng.normal(loc=0, scale=1, size=10))

Choosing between this and its neighbours? Which distribution for measurements and errors? · Which prior distribution should I use?

← NormalTruncated normal →